Anyway, I dont mind coding it if I know what to send, but python is mostly like chinese to me, so can you do me one more favor and modify websocket.py
change line 43 to:
_debug = True
Then run your app.
It will spit out the handshakes. If you copy/paste the output I can try to implement it in php.
You seem to be looking at a different version of websocket.py, there is no _debug variable at line 43 (I'm using version 0.9.0 (this is the latest version, implementing websocket version 13). I have enabled tracing, this is the log until after the channel_subscribe()
Note the messages starting with 0x81, this is the framing to delimit the messages, this is why it is absolutely no fun implementing this by hand if you can get a working implementation from somewhere. Now after looking at this dump myself I remember, my first attempt writing the webocket client myself the first problem I stumbled upon were the Sec-Websocket-Key and the Sec-Websocket-Version headers, they look slightly different for every of the dozen ws versions that exist and MtGox does not like all variants of them. The funny thing is my first implementation worked just fine with their plain websocket server and refused to connect to the socketio. Then i threw it away and used websocket.py.
2013-03-19 13:48:59,312:DEBUG:--- request header ---
2013-03-19 13:48:59,313:DEBUG:GET /socket.io/1/websocket/10083243691392078721?Currency=USD HTTP/1.1
Upgrade: websocket
Connection: Upgrade
Host: socketio.mtgox.com:443
Origin: socketio.mtgox.com:443
Sec-WebSocket-Key: UWaphFPiSqq3f2gOmaD5Sg==
Sec-WebSocket-Version: 13
2013-03-19 13:48:59,313:DEBUG:-----------------------
2013-03-19 13:48:59,313:DEBUG:--- response header ---
2013-03-19 13:48:59,762:DEBUG:HTTP/1.1 101 Switching Protocols
2013-03-19 13:48:59,763:DEBUG:Upgrade: websocket
2013-03-19 13:48:59,763:DEBUG:Connection: Upgrade
2013-03-19 13:48:59,764:DEBUG:Sec-WebSocket-Accept: Bzz8qKJPEMNNOgC4hOZd3iZNb5o=
2013-03-19 13:48:59,764:DEBUG:-----------------------
2013-03-19 13:48:59,764:DEBUG:SocketIOClient:connected
2013-03-19 13:48:59,767:DEBUG:send: '\x81\x89\x9f\x99\x10\xa1\xae\xa3*\x8e\xf2\xedw\xce\xe7'
2013-03-19 13:48:59,767:DEBUG:recv: '\x81\x031::'
2013-03-19 13:49:00,303:DEBUG:recv: '\x81\t1::/mtgox'
2013-03-19 13:49:00,304:DEBUG:SocketIOClient:subscribing to channels
2013-03-19 13:49:00,306:DEBUG:send: '\x81\xb4\xe7\xc2\xc8\xda\xd3\xf8\xf2\xf5\x8a\xb6\xaf\xb5\x9f\xf8\xb3\xf8\x93\xbb\xb8\xbf\xc5\xf8\xe8\xf8\x83\xa7\xb8\xae\x8f\xe0\xe4\xfa\xc5\xad\xb8\xf8\xdd\xe2\xea\xb7\x93\xa5\xa7\xa2\xc9\xb1\xbd\xb8\x94\xa1\xba\xb3\x85\xa7\xea\xa7'
2013-03-19 13:49:00,307:DEBUG:send: '\x81\xb5\x8c\xda\xf7\x7f\xb8\xe0\xcdP\xe1\xae\x90\x10\xf4\xe0\x8c]\xf8\xa3\x87\x1a\xae\xe0\xd7]\xf8\xb3\x94\x14\xe9\xa8\xd5S\xac\xf8\x98\x0f\xae\xe0\xd7]\xe1\xae\x90\x10\xf4\xf4\x84\n\xee\xa9\x94\r\xe5\xb8\x92]\xf1'
2013-03-19 13:49:00,307:DEBUG:send: '\x81\xb5w\xf2\x8b\xbeC\xc8\xb1\x91\x1a\x86\xec\xd1\x0f\xc8\xf0\x9c\x03\x8b\xfb\xdbU\xc8\xab\x9c\x03\x80\xea\xda\x12\x81\xa9\x92W\xd0\xe4\xceU\xc8\xab\x9c\x1a\x86\xec\xd1\x0f\xdc\xf8\xcb\x15\x81\xe8\xcc\x1e\x90\xee\x9c\n'
...and so on. Now its subscribed to all channels and should start sending data,