handle timeouts and disconnects properly
This commit is contained in:
parent
40ccb4a0dd
commit
7560660ec7
|
@ -10,6 +10,16 @@ class WebSocketProtocol(HttpProtocol):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
self.websocket = None
|
self.websocket = None
|
||||||
|
|
||||||
|
def connection_timeout(self):
|
||||||
|
# timeouts make no sense for websocket routes
|
||||||
|
if self.websocket is None:
|
||||||
|
super().connection_timeout()
|
||||||
|
|
||||||
|
def connection_lost(self, exc):
|
||||||
|
if self.websocket is not None:
|
||||||
|
self.websocket.connection_lost(exc)
|
||||||
|
super().connection_lost(exc)
|
||||||
|
|
||||||
def data_received(self, data):
|
def data_received(self, data):
|
||||||
if self.websocket is not None:
|
if self.websocket is not None:
|
||||||
# pass the data to the websocket protocol
|
# pass the data to the websocket protocol
|
||||||
|
|
Loading…
Reference in New Issue
Block a user