def send(self, method: str, params: dict) -> Awaitable:
"""Send message via the connection."""
self._lastId += 1
_id = self._lastId
msg = json.dumps(dict(
id=_id,
method=method,
params=params,
))
logger.debug(f'SEND?: {msg}')
asyncio.ensure_future(self._async_send(msg))
callback = asyncio.get_event_loop().create_future()
self._callbacks[_id] = callback
callback.method = method # type: ignore
return callback
评论列表
文章目录