0

Im currently developing a sports webapp which needs to get realtime updates.

In the application every judge needs to enter some records based on a table in the browser. In this table they enter the grades and wait until all other judges entered their grades. When all grades are saved the application should switch to the next table, where the judges need to fill out.

I'd like to use HTML5 server send message technique, becuase I'm not really a fan of pooling client side.

The problem I've now is how do I get realtime updates of the mysql table in php to send the status to the clients.

Or should I use a loop in the php script which always ask the db for updates after a short sleep. Would it be to much load for the db-server?

Balaji Kandasamy
  • 4,446
  • 10
  • 40
  • 58

2 Answers2

0

For this special case i recommend you trying out Node-JS. It can be quite hard for JS-beginners to jump in but this is as far as i know a good way to solve (pseudo-)realtime stuff.

Node.js provides good ability to handle automated process.

Jonathan
  • 1,955
  • 5
  • 30
  • 50
  • So I should create a little webserver in node.js only for the realtime functionallity? – mathewmeconry Mar 14 '14 at 10:18
  • As you told you're using PHP - you should already have a webserver running, don't you? – Jonathan Mar 14 '14 at 10:39
  • So thats enough for getting startet with Node.js if you will give it a try - there are a lot more features coming up with node.js - realtime data handling is just one of it. Another solution is Socket.io with PHP: http://stackoverflow.com/questions/6229472/socket-io-from-php-source – Jonathan Mar 14 '14 at 13:07
  • If this still wont fit your needs, you can give http://elephant.io/ a try. That combines socket.io with PHP and Node.js – Jonathan Mar 14 '14 at 13:08
  • Thanks a lot. I'll give elephant.io a try. This is what I search. For all who read this I'll solve it now this way: node.js hosting a little server which allows users to connect and subscribe to redis. with redis I can push notifications over the nodjs websocket. The whole procedure starts with the mysql update in php and php sends at the and the state over elephant.io to nodejs and nodejs to redis and from redis over nodejs to the clients. @xcy7e I hope this is the right way – mathewmeconry Mar 14 '14 at 13:23
0

You should read about and implement push notifications with sockets. Those will let you know when there were some records added, changed etc, so you can change your program workflow accordingly.

Valdas
  • 1,074
  • 13
  • 20