Python WebSocket server powered by gevent and ws4py

I am following the emerging WebSocket standard with a lot of interest. Today, I would like to update my recommendation of tools presented in the article “The best and simplest tools to create a basic WebSocket application with Flash fallback and Python on the server side”. ws4py (WebSocket for Python) by Sylvain Hellegouarch is worth spreading the word.

ws4py is still under development and may underlie considerable structural changes in the future. But what we can see so far is a cleanly written generic pure-Python WebSocket protocol implementation that can be used for servers as well as for clients. I would like to point out that — among others — a gevent-driven server is already included. I have not seen or done any benchmarks about it, but theoretically this server should be very well performing. Overall, ws4py looks very promising.

In my playground setups, I’ve replaced gevent-websocket by ws4py. This way, I successfully ran some WebSocket communication tests between the clients implemented in Firefox 7, Chrome 14, Chrome 15 and the ws4py/gevent-based server — making use of the HyBI WebSocket protocol version 10. Together with a recent version of the perfect web-socket-js, the communication also works with older browsers like Firefox 3.

Standard conformance and performance of ws4py is tested via the Autobahn WebSocket test suite. To have a testsuite like that is extremely important in order to push the development of high-quality WebSocket libraries. You should definitely look at it if you are a WebSocket client/server developer yourself.

Another thing I would like to show to you is the table at http://en.wikipedia.org/wiki/User:Oberstet/Comparison_of_WebSocket_implementations. If maintained properly, this will always be a very good reference to get an overview about WebSocket implementations on different platforms.

  • Peter

    ws4py looks indeed promising. It would be awesome, if you published your previous walk-through using gevent-websockets with ws4py instead!