Skip to content

Instantly share code, notes, and snippets.

@rogererens
Last active August 29, 2015 14:19
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rogererens/c4d93006d2f1a483fed4 to your computer and use it in GitHub Desktop.
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks
from autobahn.twisted.wamp import ApplicationSession
class Component(ApplicationSession):
@inlineCallbacks
def onJoin(self, details):
print('session attached')
def on_event(x):
print('Got event: {}'.format(x))
yield self.subscribe(on_event, u'io.crossbar.demo.vote.onreset')
def onDisconnect(self):
print('disconnected')
reactor.stop()
if __name__ == '__main__':
from autobahn.twisted.wamp import ApplicationRunner
runner = ApplicationRunner(u'wss://demo.crossbar.io/ws', u'crossbardemo')
runner.run(Component)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment