echo_raw_wsh.py (349B)
1 #!/usr/bin/python 2 3 from pywebsocket3 import msgutil 4 5 6 def web_socket_do_extra_handshake(request): 7 pass # Always accept. 8 9 def web_socket_transfer_data(request): 10 while True: 11 line = msgutil.receive_message(request) 12 if line == b'exit': 13 return 14 15 if line is not None: 16 request.connection.write(line)