async_router_req_client.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:mercury 作者: jr0d 项目源码 文件源码
def transceiver(self, payload):
        """Sends and receives messages.

        :param payload: A dict representing the message to send.
        :returns: A string representing the unpacked response.
        """

        packed = msgpack.packb(payload)

        await self.socket.send_multipart([packed])

        if self.response_timeout:
            if not await self.poller.poll(self.response_timeout * 1000):
                raise IOError('Timeout while waiting for server response')

        rep = await self.socket.recv()

        return self.check_and_return(msgpack.unpackb(rep, encoding='utf-8'))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号