>From my previous post:
----- 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 ----
this is tornado code for websocket.
On Dec 30, 4:46 pm, Manu <[email protected]> wrote:
> It is awesome, like it .
> Just looking at the video i have learn a lot of new tools( websocket,
> processing.js, html5 canvas ) . Even if i understood that web2py was
> the main tool here , would it be possible to have the websocket part
> of rocket so that we can play with this kind of tool too ( i am
> working on windows ! )
>
> You do great Massimo !!
>
> On Wed, Dec 29, 2010 at 11:38 PM, mdipierro <[email protected]> wrote:
> > version 0.2:
>
> >http://www.vimeo.com/18282084
>
> > On Dec 28, 12:55 am, mdipierro <[email protected]> wrote:
> >>http://vimeo.com/18232653
>
>