user3425765
user3425765

Reputation: 291

Calling PHP with jquery for a small chat widget

Currently I am calling a PHP script every 500 milliseconds (I want it to be a "live" chat) to get the latest chat messages and place them in the widget on the website. It all works fine but I am wondering if there's a better way to handle the message retrieving. Something like a callback when someone posts a message and only then ask PHP for new chat results.

Am I doing it the right way or are there better options.

Thanks for helping!

Upvotes: 0

Views: 151

Answers (1)

Cody Caughlan
Cody Caughlan

Reputation: 32748

Websockets and using something like http://pusher.com/ is a much better approach than "polling" for data.

Upvotes: 1

Related Questions