Commit 511f6c30 authored by liuzheng712's avatar liuzheng712

style(coco/httpd.py): that is WebSocket

parent bd3fc09f
...@@ -20,7 +20,7 @@ from .interactive import InteractiveServer ...@@ -20,7 +20,7 @@ from .interactive import InteractiveServer
logger = logging.getLogger(__file__) logger = logging.getLogger(__file__)
class BaseWehSocketHandler: class BaseWebSocketHandler:
def prepare(self): def prepare(self):
self.app = self.settings["app"] self.app = self.settings["app"]
child, parent = socket.socketpair() child, parent = socket.socketpair()
...@@ -38,7 +38,7 @@ class BaseWehSocketHandler: ...@@ -38,7 +38,7 @@ class BaseWehSocketHandler:
return True return True
class InteractiveWehSocketHandler(BaseWehSocketHandler, tornado.websocket.WebSocketHandler): class InteractiveWebSocketHandler(BaseWebSocketHandler, tornado.websocket.WebSocketHandler):
@tornado.web.authenticated @tornado.web.authenticated
def open(self): def open(self):
InteractiveServer(self.app, self.client).interact_async() InteractiveServer(self.app, self.client).interact_async()
...@@ -68,19 +68,19 @@ class InteractiveWehSocketHandler(BaseWehSocketHandler, tornado.websocket.WebSoc ...@@ -68,19 +68,19 @@ class InteractiveWehSocketHandler(BaseWehSocketHandler, tornado.websocket.WebSoc
pass pass
class ProxyWehSocketHandler(BaseWehSocketHandler): class ProxyWebSocketHandler(BaseWebSocketHandler):
pass pass
class MonitorWehSocketHandler(BaseWehSocketHandler): class MonitorWebSocketHandler(BaseWebSocketHandler):
pass pass
class HttpServer: class HttpServer:
routers = [ routers = [
(r'/ws/interactive/', InteractiveWehSocketHandler), (r'/ws/interactive/', InteractiveWebSocketHandler),
(r'/ws/proxy/(?P<asset_id>[0-9]+)/(?P<system_user_id>[0-9]+)/', ProxyWehSocketHandler), (r'/ws/proxy/(?P<asset_id>[0-9]+)/(?P<system_user_id>[0-9]+)/', ProxyWebSocketHandler),
(r'/ws/session/(?P<session_id>[0-9]+)/monitor/', MonitorWehSocketHandler), (r'/ws/session/(?P<session_id>[0-9]+)/monitor/', MonitorWebSocketHandler),
] ]
# prepare may be rewrite it # prepare may be rewrite it
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment