Skip to content

Commit 04e133f

Browse files
author
ChenDongfag
committed
modified: rosbridge_library/src/rosbridge_library/capabilities/subscribe.py
1 parent 9df09d9 commit 04e133f

File tree

1 file changed

+12
-2
lines changed
  • rosbridge_library/src/rosbridge_library/capabilities

1 file changed

+12
-2
lines changed

rosbridge_library/src/rosbridge_library/capabilities/subscribe.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,20 @@ def unsubscribe(self, msg):
308308
self.protocol.log("info", "Unsubscribed from %s" % topic)
309309

310310
def publish(self, topic, message, fragment_size=None, compression="none"):
311-
# 遍历当前主题下的所有订阅客户端
311+
"""Publish a message to the client
312+
313+
Keyword arguments:
314+
topic -- the topic to publish the message on
315+
message -- a ROS message wrapped by OutgoingMessage
316+
fragment_size -- (optional) fragment the serialized message into msgs
317+
with payloads not greater than this value
318+
compression -- (optional) compress the message. valid values are
319+
'png' and 'none'
320+
321+
"""
322+
312323
subscription = self._subscriptions.get(topic)
313324
if subscription:
314-
# 为每个客户端生成独立的消息
315325
for sid in subscription.clients:
316326
outgoing_msg = {"op": "publish", "topic": topic, "id": sid}
317327
if compression == "png":

0 commit comments

Comments
 (0)