Skip to content

Instantly share code, notes, and snippets.

@ipconfiger
Created August 7, 2013 17:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ipconfiger/6176207 to your computer and use it in GitHub Desktop.
Save ipconfiger/6176207 to your computer and use it in GitHub Desktop.
a sample usage of torcast in tornado
import tornado.ioloop
import tornado.web
from TorCast import client
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
application = tornado.web.Application([
(r"/", MainHandler),
])
def on_message(chn, message):
#when message recived, this function will be fired
if __name__ == "__main__":
application.listen(8888)
sub = client("127.0.0.1",6379,1)
sub.listen_to(["chn_1"],)
tornado.ioloop.IOLoop.instance().start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment