On Monday, February 14, 2011 9:20:29 AM UTC-5, Massimo Di Pierro wrote: 
>
> websockets use http-based long polling so I think the terminology is 
> correct, but I may be wrong.

 
I'm certainly no expert, but from what I've read, it looks like websocket is 
a separate protocol from HTTP (
http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-05#section-1.7).
 
I think the initial handshake is over HTTP but then upgraded to a websocket 
protocol connection (hence the change to the WS/WSS url scheme). Discussions 
I've seen seem to make a distinction between Comet and WebSockets (e.g., 
http://websocket.org/quantum.html, 
http://www.infoq.com/news/2008/12/websockets-vs-comet-ajax).
 
Here's a useful WebSockets rundown from Stackoverflow: 
http://stackoverflow.com/questions/4262543/what-are-good-resources-for-learning-html-5-websockets/4264861#4264861
 
Because not all browsers and servers currently support WebSockets, there are 
some libraries that implement both WebSockets and Comet techniques, 
transparently falling back to Comet if WS is not available. One example is 
Socket.IO (http://socket.io/, https://github.com/learnboost/socket.io). By 
default, Socket.IO uses node.js on the server side (
https://github.com/learnboost/socket.io-node). However, there is also a 
server-side implementation on top of Tornado called TornadIO: 
https://github.com/MrJoes/tornadio.
 

> > Also, if I'm not mistaken, this implements WebSocket communications only 
> in 
> > the server-to-client direction, but not from client to server. Do you 
> plan 
> > to add capabilities for bi-directional WS communication? 
>
> True. The idea is that communication from client should go through 
> web2py because needs authentication.

 
I don't know how difficult it would be to implement in web2py, but it sounds 
like you can authenticate a websocket upon initial connection by sending the 
session cookie: 
http://stackoverflow.com/questions/2701373/websockets-authentication/3971418#3971418
 
Best,
Anthony
 
 

Reply via email to