I was talking serverside code. Client-side my app only works with Chrome but I am looking into these: https://github.com/gimite/web-socket-js http://socket.io/
The second looks really nice. On Dec 28, 12:13 pm, Albert Abril <albert.ab...@gmail.com> wrote: > I think Orbited has the feature of emulate > websocket.http://orbited.org/wiki/WebSocket > > > > On Tue, Dec 28, 2010 at 7:04 PM, mdipierro <mdipie...@cs.depaul.edu> wrote: > > I needed something that could do http get, http post and comet via > > html5 websockets. > > > I looked at the other options gevent, twisted, etc, I either had > > installation problems, or performance issues, or it was hard to figure > > it out how to it. > > > With tornado this was trivial: > > > ----- begin ------ > > LISTENERS = [] > > class NewMsgHandler(tornado.web.RequestHandler): > > def get(self): > > self.write('<html><body>Hello</body></html>') > > def post(self): > > data = self.request.arguments['data'][0] > > [element.write_message(data) for element in LISTENERS] > > class RealtimeHandler(tornado.websocket.WebSocketHandler): > > def open(self): > > LISTENERS.append(self) > > def on_message(self, message): > > pass > > def on_close(self): > > LISTENERS.remove(self) > > application = tornado.web.Application([ > > (r'/', NewMsgHandler), # for get and post > > (r'/websocket/', RealtimeHandler), # for websockets > > ], auto_reload=True) > > http_server = tornado.httpserver.HTTPServer(application) > > http_server.listen(8888) > > tornado.ioloop.IOLoop.instance().start() > > ---- end ---- > > > On post it streams data to all clients connected with websockets. It > > runs as fast as bare metal. It cannot possibly be faster. I tried with > > up with 100 posts/seconds with 10 connected clients) and 1 post/second > > with 500 connected clients (my my laptop which does not even support > > epoll). > > > Web2py acts like a proxy for the post (does the form generation, > > validation, database IO, etc.) but stays out of the way as far as > > websockets are concerned. Web2py serves all the pages that need db > > access. > > > The clients receive data from tornado and store (do not process it > > else slows down the server, it queues it). The processing.js thread > > processes the data 5times/second for a smooth interface. > > > Massimo > > > On Dec 28, 11:27 am, David Marko <dma...@tiscali.cz> wrote: > > > Why tornado as webserver? Any observations you can share? > > > > David > > -- > Albert Abril, > @desmondohttp://bressol.org