开发者

How do I reload a shoutbox's messages whenever any one of the chatroom users posts a message?

I'm creating a shoutbox using jQuery, ajax, and php. I know how to make the message box refresh every 1 second or any set time interval, without refreshing the rest of the page, but what I really want is to have the message box refreshed every time any of the participating chatroom users posts a messages. 开发者_如何学PythonHow do i do this?

Or is just setting the refresh rate at a really short interval (like 0.2 seconds) a better option? (I was thinking this might be too hard on the server load, but it is just a text chat box so I'm not too sure. I'm writing this application to practice my coding skills so I'd really appreciate some general guidance.)


Since the nature of shoutbox is that it is a "listener", there's no real way to push an update to a remote webpage without that page checking to see if an update is required. A check every second should be sufficient, but I wouldn't go any more frequent than maybe .5 seconds.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜