austgl / phpws

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

Response is slow #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. I've copied the phpws-1.0RC to my virtual pc (centOS).
2. I've repeared the client code, because it threw JS errors:

from:

function createSocket(host){
    if(Window.WebSocket)
        return new WebSocket(host);
    else if(Window.MozWebSocket)
        return en MozWebSocket(host);
}

to:

function createSocket(host){
    if(window.WebSocket)
        return new WebSocket(host);
    else if(window.MozWebSocket)
        return new MozWebSocket(host);
}

3. Now I open client.html and I can send and receive texts. My problem, that 
between send and receive there is usually 6-7 seconds, it's unbelievable slow. 
What can be the problem? How can I solve that? I didn't change any other php 
file.

CentOS 5.7, Apache 2.2.3 (however PHP cli runs the code), PHP Version 5.3.10, 
Chrome 17.0.963.83.

Thank you so much in advance.
Laszlo Dobos

Original issue reported on code.google.com by sakrame...@gmail.com on 26 Mar 2012 at 1:02

GoogleCodeExporter commented 9 years ago
I'm running the demo.php with php cli.

Original comment by sakrame...@gmail.com on 26 Mar 2012 at 1:03

GoogleCodeExporter commented 9 years ago
I debug a little bit. I uncomment this line in websocket.server:
$this->debug("Socket selected");

Now I send text again and check the console. I see a lot of "Socket selected" 
row for 4 seconds... then I see:

dispatchMessage
[ECHO] 2097152 bytes

for 3 seconds, then I see Socket selected messages for 1 seconds and then I see 
the response in the client.html. 

Interesting that these seconds are always the same. What's the problem? Thank 
you.

Original comment by sakrame...@gmail.com on 26 Mar 2012 at 2:53

GoogleCodeExporter commented 9 years ago
Big messages (2MB is the demo) are indeed slow. Its a known issue, however when 
using smaller messages you wont notice the delay. The slowdown is in the XOR 
demasking in the protocol. I got mixed results when I tried to speed this 
process up.

Original comment by ch...@devristo.com on 30 Mar 2012 at 5:24

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
replace in client.html, line 48 by :
   var msg = $('msg').value;

Original comment by Sylvain....@gmail.com on 3 Apr 2012 at 12:40

GoogleCodeExporter commented 9 years ago
Done and comitted :)

Original comment by ch...@devristo.com on 21 May 2012 at 6:23