#NEWLINE# @ inlineCallbacks #NEWLINE# def onJoin( self , details ) : #NEWLINE# #INDENT# print ( 'session attached' ) #NEWLINE# def on_event( i ) : #NEWLINE# #INDENT# print ( 'Got event: {}' . format ( i ) ) #NEWLINE# #UNINDENT# ( yield self . subscribe ( on_event , 'com.myapp.topic1' ) ) #NEWLINE# counter = 0 #NEWLINE# while True : #NEWLINE# #INDENT# print ( 'publish: com.myapp.topic1' , counter ) #NEWLINE# pub_options = PublishOptions ( acknowledge = True , exclude_me = False ) #NEWLINE# publication = ( yield self . publish ( 'com.myapp.topic1' , pub_options , options = pub_options ) ) #NEWLINE# print ( 'Published with publication ID {}' . format ( publication . id ) ) #NEWLINE# counter += 1 #NEWLINE# ( yield sleep ( 1 ) )