How to send Autobahn/Twisted WAMP message from outside of protocol?
问题 I am following the basic wamp pubsub examples in the github code: This example publishes messages from within the class: class Component(ApplicationSession): """ An application component that publishes an event every second. """ def __init__(self, realm = "realm1"): ApplicationSession.__init__(self) self._realm = realm def onConnect(self): self.join(self._realm) @inlineCallbacks def onJoin(self, details): counter = 0 while True: self.publish('com.myapp.topic1', counter) counter += 1 yield