Created
August 7, 2013 17:15
-
-
Save ipconfiger/6176207 to your computer and use it in GitHub Desktop.
a sample usage of torcast in tornado
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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