Reputation: 619
I was just watching a ajax/php web chat client video from phpacademy (Link to the youtube videos) and I had a question about pushing and fetching. In the video they fetched the data from the MySQL database every second or so.
But my question is, is there anyway to push the chat to other connected users rather than fetching it? With the application I'm developing, It would be a lot of requests on the server and be a waste of bandwidth.
But I still want it to be as basic as the ajax/php chat system. What I'm developing is a turn base game and the idea/code behind the chat system is exactly what I'm looking for. But instead of sending a text message it might send a score, move, and/or time, etc. and having it fetch wouldn't be ideal for the server when there maybe multiple people connected.
thanks for the comments and answers.
Upvotes: 0
Views: 1006
Reputation: 317
in javascript you may use setInterval('Messages()', 8000); for get news messages in your db EVERY 8 SECS, if this is true you show them.
Upvotes: 0
Reputation: 3225
It sounds like your after something like Socket.io, or if you cant set that up you could use http://pusher.com/
Upvotes: 2