#NEWLINE# def messageReceived( self , message ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ( msgtype , topic , payload ) = self . _messageSplit ( message ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# log . msg ( ( 'invalid message received <%s>' % message ) ) #NEWLINE# return #NEWLINE# #UNINDENT# if ( topic not in self . channels ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# if ( topic in self . endpoints ) : #NEWLINE# #INDENT# session = self . endpoints [ topic ] #NEWLINE# if ( msgtype == 'uns' ) : #NEWLINE# #INDENT# del self . endpoints [ topic ] #NEWLINE# session . _close ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( msgtype == 'msg' ) : #NEWLINE# #INDENT# if payload : #NEWLINE# #INDENT# session . messageReceived ( payload ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if ( msgtype == 'sub' ) : #NEWLINE# #INDENT# session_args = ( self . channels [ topic ] , self . session . server , self , topic ) #NEWLINE# session = self . session . server . create_session ( session_id = None , register = False , session_factory = ( MultiplexChannelSession , session_args , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ) #NEWLINE# session . set_handler ( self . handler ) #NEWLINE# session . verify_state ( ) #NEWLINE# self . endpoints [ message ] = session