A while ago I had a need for a simple WebSocket (RFC 6455) client, nothing fancy, just enough to verify few things are working correctly on a sever. All python libraries I could find were a bit on the heavy side, so I wrote a simple WebSocket client class from scratch. I'm sure it doesn't support everything but for me this is good enough.
Code is here, it can be use either standalone or as a module. By default is takes input from stdin and writes to stdout. It is asynchronous.
usage: ./websocket.py target port path
target is the IP or a hostname to which we want to connect
port is a TCP port on which the service is listening
path is the WebSocket path