views:

21

answers:

2

i am using python3.1 ,so i found a html5 websocket snippet here:

http://www.nublue.co.uk/blog/threaded-python-websocket-server-and-javascript-client/

I test with chrome.

After send handshake packet,web client has no response as expect(websocket.onopen is not fired).I do receive client's request. .i tried many times.It just not work.


Here is a .NET code:

http://nugget.codeplex.com/

I test it,it works fine.so my chrome is ok. I wanna know is there any python3.x demo code can give me a help.

And my machine: WIN7 pro X86

thanks.

A: 

oh.i got it .

that article is obsolete.

and see:

http://en.wikipedia.org/wiki/Web_Sockets

sum of the concatenated string.[1]

sum of the concatenated string.[1]> The Sec-WebSocket-Key1 and

Sec-WebSocket-Key2 fields and the 8 bytes after the fields are random tokens which the server uses to construct a 16-byte token at the end of its handshake to prove that it has read the client's handshake. The handshake is constructed by concatenating the numbers from the first key, and dividing by the number of spaces. This is then repeated for the second key. The two resulting numbers are concatenated with each other, and with the last 8 bytes after the fields. The final result is an MD5 sum of the concatenated string.[1]sum of the concatenated string.[1]

sum of the concatenated string.[1]

Haozes
A: 

The noVNC project (a HTML5 VNC client) contains a python 2.X (but should be easy to convert to 3.X) utility named wsproxy which is a WebSockets to generic TCP proxy. It transparently supports v75 and v76 (which has new handshake) of the WebSockets protocol.

If you're still working on it, that might be a helpful reference at least.

Disclaimer: I made noVNC and wsproxy.

kanaka