fullstackpython.com
                                
                                 fullstackpython.com copied to clipboard
                                
                                    fullstackpython.com copied to clipboard
                            
                            
                            
                        Couple of suggestions for the WebSocket page
Overall the content is very good (as usual). But I have a few small corrections:
- The WebSocket diagram shows only server-push, but that is half of what you can do (as you correctly indicate in the description above). I think it would be good to add independent arrows that go from client to server, to indicate that both the client and the server can freely initiate an exchange at any time.
- The following sentence is incorrect with respect to the client-side:
Both a JavaScript library on the web browser and a WebSockets implementation on the server are necessary to establish and maintain the connection between the client and server.
There is native support for the WebSocket protocol in most browsers. In many cases clients use a wrapper library, but that is technically not required, as browsers expose the WebSocket object.
I think that either here in this place, or later in the document you have to describe Socket.IO as pair of client and server libraries that wrap WebSocket. The nice thing about Socket.IO is that if you run it on a browser that doesn't have native WebSocket support, it can emulate the real-time communication using long polling or other methods and the implementation differences are hidden by the library. The important point here is that WebSocket != Socket.IO, which I think is not totally clear now.
- WebSocket friendly servers for Python
A discussion on how to support WebSocket server-side is missing. You mention gevent a couple of times, but I think it would be helpful to discuss the implications of WebSocket on the server. Something on the lines of: since the connection is long lived, a multi-threaded or multi-process based server cannot scale appropriately, so you need an asynchronous server such as gevent for any practical implementation.
Definitely agree on all these points @miguelgrinberg. Working on a couple of updates to the page I think will clarify, especially the point about needing a JS library instead of the libraries just exposing the browser API in a more developer-friendly cross-browser way.