Ferex
Ferex

Reputation: 575

PHP & Ajax: manage list update

I have a chat service based on polling: every 20 seconds a script is run on server (by every client) to retrieve new user in chat-room. I want to optimize this. I want to download data only for new users that just entered the chat, I don't want to re-download old data about old users. I could solve by sending in the request the userid of people I already have, check if there are new users and apped their data to the list on client; I think this is better than before... but ... is there a better way?

Upvotes: 0

Views: 56

Answers (1)

Calvin Froedge
Calvin Froedge

Reputation: 16373

Yes! There is a better way. Use web sockets to distribute changes to clients in real time:

http://socketo.me/

On the client side, https://www.websocket.org/

Upvotes: 1

Related Questions