#NEWLINE# @ gen . coroutine #NEWLINE# def send_message( self , message ) : #NEWLINE# #INDENT# if ( e . _socket is None ) : #NEWLINE# #INDENT# log . info ( "We're disconnected, so not sending message %r" , message ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# sent = ( yield message . send ( self . _socket ) ) #NEWLINE# log . debug ( 'Sent %r [%d bytes]' , message , sent ) #NEWLINE# #UNINDENT# except WebSocketError as e : #NEWLINE# #INDENT# log . debug ( 'Error sending message to server: %r' , e ) #NEWLINE# self . close ( why = 'received error while sending' ) #NEWLINE# #UNINDENT# #UNINDENT# raise gen . Return ( None )