Web based text chat?

前端 未结 3 1412
情深已故
情深已故 2021-01-03 01:17

I\'d like to develop a near real time web based chat system. Any suggestions on how to implement this via jQuery, any gotchas to look out for, and what is this Comet thing I

3条回答
  •  日久生厌
    2021-01-03 01:53

    Comet is a "push" tecnology, created to avoiding the client (javascript code) to continously poll the server. This could cause bandwith problem, because you have to create (maybe) a new TCP connection, then contact the http server, he runs some server-side logic and then sends a response to the client. With comet, if the server decide that you should recive some information (e.g., new chat message) he directly send it to the client.

    There are several different implementation, you can have a start here.

    the simplest implementation tecnique is the hidden iframe, but I'd raccomend the long polling wich is much more controllable.

    One more thing, thake a look at HTML5 websokets, wich could be an interesting solution to your problem (not very compatible with current browser, anyway)

提交回复
热议问题