如果设置了心跳,则调用这个协程.

async def _heartbeat_callback(self):
        """如果设置了心跳,则调用这个协程."""
        query = {
            "MPRPC": self.VERSION,
            "HEARTBEAT": "ping"
        }
        queryb = self.encoder(query)
        while True:
            await asyncio.sleep(self.heart_beat)
            self.writer.write(queryb)
            if self.debug is True:
                print("ping")