Esempio n. 1
0
 def messageUnsubscribe(self,message,handler=None):
     message = uriFromMessage(message)
     handlers = self._messages[message]
     if handler:
         handlers.remove(handler)
     if not (handler and handlers):
         del self._messages[message]
         return self.unsubscribe(message)
Esempio n. 2
0
 def messageUnsubscribe(self, message, handler=None):
     message = uriFromMessage(message)
     handlers = self._messages[message]
     if handler:
         handlers.remove(handler)
     if not (handler and handlers):
         del self._messages[message]
         return self.unsubscribe(message)
Esempio n. 3
0
    def dispatch(self,name,*data):
        """
        send message to those subscribed

        @param name: message type
        @type name: string

        @param data: message payload
        """
        self.factory.dispatch(uriFromMessage(name),*data)
Esempio n. 4
0
    def messageSubscribe(self,message,handler):
        """
        @param message: message type to subscribe to
        @type message: string

        @param handler: callable f(*args) to which message
            payload is delivered
        """
        message = uriFromMessage(message)
        if message not in self._messages:
            d = self.subscribe(message,self._onMessage)
        else:
            d = None
        self._messages.setdefault(message,[]).append(handler)
        return d
Esempio n. 5
0
    def messageSubscribe(self, message, handler):
        """
        @param message: message type to subscribe to
        @type message: string

        @param handler: callable f(*args) to which message
            payload is delivered
        """
        message = uriFromMessage(message)
        if message not in self._messages:
            d = self.subscribe(message, self._onMessage)
        else:
            d = None
        self._messages.setdefault(message, []).append(handler)
        return d
Esempio n. 6
0
 def onSessionOpen(self):
     self.registerForRpc(self.factory.wamp, SITZ_RPC_URI)
     for message in self.factory.wamp.MESSAGES.keys():
         self.registerForPubSub(uriFromMessage(message))