def METHOD_NAME(self, message: Command) -> None:
    _logger.debug(f'Sending {message}')
    try:
        _wait(self._ws.METHOD_NAME(nni.dump(message)))
    except websockets.ConnectionClosed:  # type: ignore
        _logger.debug('Connection closed by server.')
        self._ws = None
        _decrease_refcnt()
        raise