Package rospy :: Module topics :: Class SubscribeListener

Class SubscribeListener

source code

object --+
         |
        SubscribeListener

Callback API to receive notifications when new subscribers connect and disconnect.

Instance Methods
 
peer_subscribe(self, topic_name, topic_publish, peer_publish)
callback when a peer has subscribed from a topic
source code
 
peer_unsubscribe(self, topic_name, num_peers)
callback when a peer has unsubscribed from a topic
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

peer_subscribe(self, topic_name, topic_publish, peer_publish)

source code 

callback when a peer has subscribed from a topic

Parameters:
  • topic_name (str) - topic name. NOTE: topic name will be resolved/remapped
  • topic_publish (fn(data)) - method to publish message data to all subscribers
  • peer_publish (fn(data)) - method to publish message data to new subscriber. NOTE: behavior for the latter is transport-dependent as some transports may be broadcast only.

peer_unsubscribe(self, topic_name, num_peers)

source code 

callback when a peer has unsubscribed from a topic

Parameters:
  • topic_name (str) - topic name. NOTE: topic name will be resolved/remapped
  • num_peers (int) - number of remaining peers subscribed to topic