开发者

HTML5 Websockets Server Requirements

开发者 https://www.devze.com 2023-01-29 16:20 出处:网络
I have spent the whole of yesterday trying to get my head round HTML5 websockets, but am still a little confused about a few points:

I have spent the whole of yesterday trying to get my head round HTML5 websockets, but am still a little confused about a few points:

  1. Do I need to install any further add ons to my apache server to run a websocket server?
  2. Is it possible to run websockets on a shared server setup without access to the server root?
  3. Are websockets going to be supported by IE9, if not then is there any point working with them if there is such limited browser support? Should I look at polling techniques instead?
  4. How does one go about running simultaneous websockets (eg multiple chat app instances) how is each one uniquely defined?
  5. Is there a reliable fallback for browsers that don't support websockets?

Hope someone out there can help me understand these points,开发者_如何转开发 very greateful!

W.


Don't think of WebSockets as a web server plugin. WebSockets is a way to establish a (nearly) raw socket connection between a browser and something else. There is some desire on the standards committee to allow web servers to easily forward WebSocket connections to their target service, however as of v76 of the protocol the WebSockets handshake is explicitly incompatible with HTTP setup (for vague security reasons). This may change back in the future especially now that a serious security issue has been found in the v76 setup process.

Yes, the WebSockets handshake looks a lot like HTTP, so it's easy to get confused, but even when it was compatible with an HTTP Upgrade request, it was still just to enable easy forwarding by the web server, not so that the webserver could become a WebSockets server.

There is a recent security issue in WebSockets which probably means most browser makers will disable WebSockets until the next version of the protocol is ready, but apart from that WebSockets is pretty much universally support because browsers without native support can use web-socket-js which is a Flash based fallback. iOS 4.2 also has WebSockets support (although again, that may get disabled temporarily due to the security issue).

So the answers to your questions are: 1) Mu 2) Yes 3) Unlikely 4) Not defined by WebSockets 5) Yes: see web-socket-js


Is there a reliable fallback for browsers that don't support websockets?

Socket.IO seems to work well. I haven't developed with it yet myself, but I've tested apps that use it with browsers that don't support WebSockets natively.

For what it's worth, you may want to drop the HTML5 when talking about and/or researching this. WebSockets are no longer part of HTML5. If you search for information on "HTML5 WebSockets", you're more likely to find dated info.


1) No. 2) Yes. 3) Who knows. And Microsoft isn't saying, as usual, but probably not.

Firefox, Chrome and Opera have all announced they will not support web sockets for now because the standard is incomplete and has security issues. It may be too early to be messing with this right now.

0

精彩评论

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