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)
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)
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)
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
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
def onSessionOpen(self): self.registerForRpc(self.factory.wamp, SITZ_RPC_URI) for message in self.factory.wamp.MESSAGES.keys(): self.registerForPubSub(uriFromMessage(message))