开发者

Live Connection from Javascript/html

Is there a way to have a live 开发者_如何学Goconnection (like for a chat server) with a server using only HTML(5)/JavaScript?


Apparently FF4, Chrome, and Safari all support Web Sockets.

Here's a firefox example, although I'm not sure the spec is completely finalized yet.


Due to the nature of HTTP (only clients can start requests), you would need a "Push" server (aka Comet) on the server-side. You'd still only need JS on the client. See:

  • HTTP Streaming for an explanation of the technology
  • APE: Ajax Push Engine for usable implementation
  • Comet Daily for news on Comet

This can also be implemented with a periodic refresh (polling) if you can't install a Comet engine on the server.


Yup. AJAX and some server code to handle messages updates is all you need to create just such a system. As @NullUserException noted, something like Comet might make this easier.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜