Пример #1
0
 def _handle_close(self, event: CloseConnection) -> None:
     self._running = False
     if EventType.DISCONNECT in self._callbacks:
         self._callbacks[EventType.DISCONNECT](event)
     # if the server sends first a close connection we need to reply with another one
     if self._ws.state is ConnectionState.REMOTE_CLOSING:
         self._sock.sendall(self._ws.send(event.response()))
Пример #2
0
 def _handle_close_event(self, event: CloseConnection) -> None:
     if self._ws.state is ConnectionState.REMOTE_CLOSING:
         self._client.sendall(self._ws.send(event.response()))
Пример #3
0
 async def _handle_close_connection_event(self, event: CloseConnection):
     await anyio.sleep(0)
     if self.state is ConnectionState.REMOTE_CLOSING:
         await self._send(event.response())
     await self._close_handshake.set()