Пример #1
0
 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)
Пример #2
0
    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)
Пример #3
0
 def add_channel(self, ch):
     root = self._manager.get_root_channel()
     root.add_client(self, BayeuxChannel.split(ch))
Пример #4
0
 def delete_channel(self, ch):
     root = self._manager.get_root_channel()
     root.remove_client(self, BayeuxChannel.split(ch))
Пример #5
0
 def add_channel(self, ch):
     root = self._manager.get_root_channel()
     root.add_client(self, BayeuxChannel.split(ch))
Пример #6
0
 def delete_channel(self, ch):
     root = self._manager.get_root_channel()
     root.remove_client(self, BayeuxChannel.split(ch))