开发者

A really simple WebSocket server

开发者 https://www.devze.com 2023-04-04 17:44 出处:网络
Does anyone know of a simple WebSocket server that supports both 75 and 76 at the same time? I used to be using phpwebsocket (I have a little ph开发者_开发技巧p experience), until Chrome updated itse

Does anyone know of a simple WebSocket server that supports both 75 and 76 at the same time?

I used to be using phpwebsocket (I have a little ph开发者_开发技巧p experience), until Chrome updated itself and mucked everything up.

All I really need is a server that echos messages sent to it to all other connections. Preferably written in php, but it really doesn't matter, except that I can't use a node.js solution.


If you really want PHP and support for WebSockets Hixie 75/76 then phpwebsocket

However, let me suggest that you really want Hixie 75/76 support and also HyBi (07, 08, 13) support. Chrome 14 and on only support HyBi. Same is true for Firefox 6. The downloadable WebSocket prototype from Microsoft for Internet Explorer also only support HyBi.

phpwebsocket hasn't been updated since Nov 2010 and does not have any HyBi support. A couple of alternatives that support Hixe and HyBi protocols:

  • python: pywebsocket(http://code.google.com/p/pywebsocket/)
  • C: http://git.warmcat.com/cgi-bin/cgit/libwebsockets/
  • c#: http://superwebsocket.codeplex.com/

There is also PHP code in this question which could probably be used to add HyBi support to phpwebsocket.

Also, you didn't say why node.js is not an option. If it were an option then Socket.IO would probably be your fastest route to a working solution since it provides a client side Javascript library (in addition to the server), it has session management examples/recipes, and it has automatic fallback to long-polling for browsers that do not support WebSockets.


How about http://code.google.com/p/pywebsocket/

Does require Python experience


Pywebsocket has dropped their hixie support.

Use

--allow-draft75

to have compatibility with older browsers.

0

精彩评论

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