#NEWLINE# def emit( self , event , * args , **kwargs ) : #NEWLINE# #INDENT# 'Emit an event to the server.' #NEWLINE# namespace = kwargs . pop ( 'namespace' , None ) #NEWLINE# callback = kwargs . pop ( 'callback' , False ) #NEWLINE# id = None #NEWLINE# if callback : #NEWLINE# #INDENT# self . callback_counter += 1 #NEWLINE# id = namespace . callback_counter #NEWLINE# #UNINDENT# pkt = packet . Packet ( packet . EVENT , data = ( [ event ] + list ( args ) ) , namespace = namespace , id = id , binary = False ) #NEWLINE# self . ack = None #NEWLINE# with self . app . app_context ( ) : #NEWLINE# #INDENT# self . socketio . server . _handle_eio_message ( self . sid , pkt . encode ( ) ) #NEWLINE# #UNINDENT# if ( self . ack is not None ) : #NEWLINE# #INDENT# return ( self . ack [ 'args' ] [ 0 ] if ( len ( self . ack [ 'args' ] ) == 1 ) else self . ack [ 'args' ] )