sittichoke / phpwebsocket

Automatically exported from code.google.com/p/phpwebsocket
0 stars 0 forks source link

Handshaking wasn't complete #16

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The handshaking process wasn't complete, I've attached a version with 
handshaking and slight changes for draft 76

Original issue reported on code.google.com by thekid.a...@gmail.com on 14 Aug 2010 at 9:59

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you so much for your attachment. I like the consolidated websocket 
class...no more SocketWebSocket and WebSocket! Also, I just got into this a few 
days ago and could never get it to handshake (even though it said 'done 
handshaking' the onopen would never fire...now it does! I will be interested in 
seeing what the difference was...(unless you would like to give me a hint!)

Thanks again for saving my sanity.

Original comment by kevin.t....@gmail.com on 7 Oct 2010 at 4:45

GoogleCodeExporter commented 8 years ago
Thanks again for saving my sanity! That's very cool...or I will go nuts...

Thank you very much!! That's great!!

Original comment by kimiyaya...@gmail.com on 12 Oct 2010 at 1:56

GoogleCodeExporter commented 8 years ago
a little problem...when we send the first word, no matter "hello" or "hi", the 
client has no display of the response. But the following word can get response.

Original comment by kimiyaya...@gmail.com on 12 Oct 2010 at 2:02

GoogleCodeExporter commented 8 years ago
Hi, I had the same experience, that the first msg is fail.
this had fixt it:
js:
        socket.onmessage = function(msg)
        {
            var mes,txt;
            set_message('neue nachricht: '+msg.data);

            mes = msg.data;
            // remove mystery char
            if(0 == mes[0].charCodeAt())
            {
                mes = mes.substring(1);
            } // if 

Original comment by informMa...@gmail.com on 19 Oct 2010 at 1:26

GoogleCodeExporter commented 8 years ago
I have the same problem that the first word doesn't get a response. The socket 
onmessage event is actually not triggered (the first time) so the fix doesn't 
work. From the second message onwards it is all fine. Perhaps related to issue 
15 (http://code.google.com/p/phpwebsocket/issues/detail?id=15)?

(I am using Chrome 8.0.552.215 on Windows XP)

Original comment by chr...@fastmail.fm on 10 Dec 2010 at 10:34

GoogleCodeExporter commented 8 years ago
My solution for this issue is to change line 102 in websocket.class.php to

socket_write($user->socket,$upgrade.chr(0).chr(255),strlen($upgrade)+2);

(so added a non-breaking space).

Original comment by chr...@fastmail.fm on 10 Dec 2010 at 12:57

GoogleCodeExporter commented 8 years ago
Hi, 
i have the same problem : the fist message always raise an "onerror" event on 
the client. The others messages works fine.
With the little trick above the first message don't raise an "onerror" event, 
but the event 'onerror' raise on the connection (no problem because websockets 
works properly after that).

Original comment by cyberbo...@gmail.com on 7 Jan 2011 at 6:06

GoogleCodeExporter commented 8 years ago
To remove the onerror message, remove the two new line at the end of the 
handshake ("\r\n\r\n").
There's also no need to add an empty frame after the handshake.

Original comment by malle...@gmail.com on 9 Feb 2011 at 3:55

GoogleCodeExporter commented 8 years ago
Thank you. also comment 6 fixed the problem of not sending the first message.

Original comment by mrdesjar...@gmail.com on 22 Feb 2011 at 2:10

GoogleCodeExporter commented 8 years ago
i can confirm that comment 6 fixes the issue as well

Original comment by bbormanc...@gmail.com on 23 Jun 2011 at 2:50