def publish(self, msg): '''Publishes a message to all clients subscribed to its channel.''' # strip off client ID before sending out to other clients try: senderId = msg['clientId'] del msg['clientId'] except KeyError: senderId = None try: del msg['id'] except KeyError: pass ch = msg.get('channel', None) # find all subscribed clients clients = set() self._root.collect_clients(clients, BayeuxChannel.split(ch)) for cl in clients: cl.add_message(msg, senderId)
def add_channel(self, ch): root = self._manager.get_root_channel() root.add_client(self, BayeuxChannel.split(ch))
def delete_channel(self, ch): root = self._manager.get_root_channel() root.remove_client(self, BayeuxChannel.split(ch))