MCPcopy Create free account
hub / github.com/PaddlePaddle/FastDeploy / pub

Method pub

fastdeploy/inter_communicator/fmq.py:285–295  ·  view source on GitHub ↗
(self, data: Any)

Source from the content-addressed store, hash-verified

283 self._task = None
284
285 async def pub(self, data: Any):
286 # Publish a message
287 if not self._pub_socket:
288 ep = f"{self.endpoint.protocol}://{self.endpoint.address}"
289 self._pub_socket = self.context.socket(zmq.PUB)
290 self._pub_socket.bind(ep)
291 await asyncio.sleep(0.05)
292
293 msg = Message(payload=data)
294 async with self.lock:
295 await self._pub_socket.send(msg.serialize())
296
297 async def sub(self, callback: Callable[[Message], Any]):
298 # Subscribe and handle messages

Callers 1

run_testMethod · 0.80

Calls 6

serializeMethod · 0.95
MessageClass · 0.85
socketMethod · 0.80
bindMethod · 0.80
sleepMethod · 0.45
sendMethod · 0.45

Tested by 1

run_testMethod · 0.64