1from __future__ import print_function 2import websocket 3 4if __name__ == "__main__": 5 websocket.enableTrace(True) 6 ws = websocket.create_connection("ws://echo.websocket.org/") 7 print("Sending 'Hello, World'...") 8 ws.send("Hello, World") 9 print("Sent") 10 print("Receiving...") 11 result = ws.recv() 12 print("Received '%s'" % result) 13 ws.close() 14