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'))
评论列表
文章目录