The problem that the web server needs to keep many connections open
(whether long polling or websocket) and a normal web server cannot
handle the traffic because of too many threads. It requires an async
server like tornado and/or lightweight threads like erlang or node.js.

Implementing it in web2py would be pointless. Yet web2py can work as
middlewere and work with tornado as in the example.

Massimo

On Feb 14, 4:08 pm, Anthony <abasta...@gmail.com> wrote:
> 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#se...).
> 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-fo...
>
> 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/...
>
> Best,
> Anthony

Reply via email to