def web_socket_transfer_data(request):

    while True:
        line = request.ws_stream.receive_message()
        if line is None:
            return
        if isinstance(line, unicode):
            request.ws_stream.send_message(line, binary=False)
            if line == _GOODBYE_MESSAGE:
                return
        else:
            request.ws_stream.send_message(line, binary=True)


# vi:sts=4 sw=4 et
Echo. Same as echo_wsh.py.
dataset/ETHPy150Open google/pywebsocket/example/echo_noext_wsh.py/web_socket_transfer_data