def send(self, conn):
        ''' Send the message on the given connection.

        Args:
            conn (WebSocketHandler) : a WebSocketHandler to send messages

        Returns:
            int : number of bytes sent

        '''
        if conn is None:
            raise ValueError("Cannot send to connection None")

        with (yield conn.write_lock.acquire()):
            sent = 0

            yield conn.write_message(self.header_json, locked=False)
            sent += len(self.header_json)

            # uncomment this to make it a lot easier to reproduce lock-related bugs
            #yield gen.sleep(0.1)

            yield conn.write_message(self.metadata_json, locked=False)
            sent += len(self.metadata_json)

            # uncomment this to make it a lot easier to reproduce lock-related bugs
            #yield gen.sleep(0.1)

            yield conn.write_message(self.content_json, locked=False)
            sent += len(self.content_json)

            sent += yield self.write_buffers(conn, locked=False)

            raise gen.Return(sent)
def send ( self , conn ) : if conn is None : raise ValueError ( "Cannot send to connection None" ) with ( yield conn . write_lock . acquire ( ) ) : sent = 0 yield conn . write_message ( self . header_json , locked = False ) sent += len ( self . header_json ) yield conn . write_message ( self . metadata_json , locked = False ) sent += len ( self . metadata_json ) yield conn . write_message ( self . content_json , locked = False ) sent += len ( self . content_json ) sent += yield self . write_buffers ( conn , locked = False ) raise gen . Return ( sent )
Send the message on the given connection.

        Args:
            conn (WebSocketHandler) : a WebSocketHandler to send messages

        Returns:
            int : number of bytes sent