Skip to content

Instantly share code, notes, and snippets.

@mrjoes
Created December 11, 2011 21:01
Show Gist options
  • Save mrjoes/1462720 to your computer and use it in GitHub Desktop.
Save mrjoes/1462720 to your computer and use it in GitHub Desktop.
Dummy server
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