Created
December 11, 2011 21:01
-
-
Save mrjoes/1462720 to your computer and use it in GitHub Desktop.
Dummy server
This file contains 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
from tornado import web, websocket, ioloop | |
class Test(websocket.WebSocketHandler): | |
clients = set() | |
def open(self): | |
self.clients.add(self) | |
def on_message(self, msg): | |
for c in self.clients: | |
c.write_message(msg) | |
def on_close(self): | |
self.clients.remove(self) | |
if __name__ == '__main__': | |
app = web.Application([(r'/', Test)]) | |
app.listen(8080) | |
ioloop.IOLoop.instance().start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment