def subscribe(self, sid=None, msg_type=None, throttle_rate=0, queue_length=0, fragment_size=None, compression="none"): """ Add another client's subscription request If there are multiple calls to subscribe, the values actually used for queue_length, fragment_size, compression and throttle_rate are chosen to encompass all subscriptions' requirements Keyword arguments: sid -- the subscription id from the client msg_type -- the type of the message to subscribe to throttle_rate -- the minimum time (in ms) allowed between messages being sent. If multiple subscriptions, the lower of these is used queue_length -- the number of messages that can be buffered. If multiple subscriptions, the lower of these is used fragment_size -- None if no fragmentation, or the maximum length of allowed outgoing messages compression -- "none" if no compression, or some other value if compression is to be used (current valid values are 'png') """ # Subscribe with the manager. This will propagate any exceptions manager.subscribe(self.client_id, self.topic, self.on_msg, msg_type) client_details = { "throttle_rate": throttle_rate, "queue_length": queue_length, "fragment_size": fragment_size, "compression": compression } self.clients[sid] = client_details self.update_params()
def subscribe(self, sid=None, msg_type=None, throttle_rate=0, queue_length=0, fragment_size=None, compression="none"): """ Add another client's subscription request If there are multiple calls to subscribe, the values actually used for queue_length, fragment_size, compression and throttle_rate are chosen to encompass all subscriptions' requirements Keyword arguments: sid -- the subscription id from the client msg_type -- the type of the message to subscribe to throttle_rate -- the minimum time (in ms) allowed between messages being sent. If multiple subscriptions, the lower of these is used queue_length -- the number of messages that can be buffered. If multiple subscriptions, the lower of these is used fragment_size -- None if no fragmentation, or the maximum length of allowed outgoing messages compression -- "none" if no compression, or some other value if compression is to be used (current valid values are 'png') """ client_details = { "throttle_rate": throttle_rate, "queue_length": queue_length, "fragment_size": fragment_size, "compression": compression } self.clients[sid] = client_details self.update_params() # Subscribe with the manager. This will propagate any exceptions manager.subscribe(self.client_id, self.topic, self.on_msg, msg_type)