This commit is contained in:
Kovid Goyal 2015-10-28 14:48:32 +05:30
parent 875f10287e
commit 3c3f65f1c2

View File

@ -550,8 +550,13 @@ class EchoHandler(object):
def handle_websocket_close(self, connection_id):
self.ws_connections.pop(connection_id, None)
if __name__ == '__main__':
def run_echo_server():
s = ServerLoop(create_http_handler(websocket_handler=EchoHandler()))
with HandleInterrupt(s.wakeup):
s.serve_forever()
if __name__ == '__main__':
# import cProfile
# cProfile.runctx('r()', {'r':run_echo_server}, {}, filename='stats.profile')
run_echo_server()
# }}}