Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm working on the project 'vote/poll' on android device's. I want it to work like this: - Users can login(I got REST API php for login/register and its okay for me and working), - Admin can create new voting(available options: yes, no) - i can do it with rest api and its easy for me(I'm beginner). My problem is how to display question and answers(yes/no) for all logged users? I think that I can make async method in client side like timer(send request to api per 1 sec and check new question in database, if it's new return response json) but i think that it's not professional(?) and very expensive(for server). Second solution is websocket but I have never used it and I'm afraid of it that I can't handle it. What do you think? Is there any other way?

BTW: 40 employees will use my system(Every Saturday for 3-5h only).

What I have tried:

I got rest API for register/login and create question but i don't know how to display in realtime question for Admin.
Posted
Updated 6-Jan-20 7:55am

1 solution

40 queries per second if polling for 40 users at once per second. The simplest way to reduce traffic is to poll "less than once per second". And not at all if not necessary.
 
Share this answer
 
Comments
jrJery 6-Jan-20 14:46pm    
If the user has the application open all the time(Every Saturday) I would have to send request per 1 sec to API for check global variable and if the global variable for example is equal 2 i have to request to API for question two from database. What do you think? I could limit my queries to the database.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900