예제 #1
0
    async def handle(self, connection: ConnectionAPI, msg: Payload) -> None:
        msg = cast(Dict[str, Any], msg)
        try:
            reason = DisconnectReason(msg['reason'])
        except TypeError:
            self.logger.debug('Got unknown disconnect reason reason: %s', msg)
        else:
            self.disconnect_reason = reason

        if connection.is_operational:
            connection.cancel_nowait()
예제 #2
0
    async def handle(self, connection: ConnectionAPI, cmd: Disconnect) -> None:
        self.disconnect_reason = cmd.payload

        if connection.is_operational:
            connection.cancel_nowait()