Closed meghapl closed 8 years ago
Hi meghawgt, make sure you've changed the settings in testwebsock.php and try,
host = 'ws://xx.com:9006';
Hi @LGaitan in client.html page i changed the host : var host = "ws://xxx.xx.xx.xxx:9006/echobot"; // SET THIS TO YOUR SERVER and in testserver.php page : $echo = new echoServer("xxx.xx.xx.xxx","9006");
still the same.
on local server after : Master socket: Resource id #6 you start seeing this line each time you connect with new client : Client connected #7 but didn't see it in live server right ?
first in testserver.php you can keep 0.0.0.0 unless you have multiple ip for the same server and only want to respond to ONLY one IP.
If you didn't see the Client connected # line that mean the server never receive the request and most probably mean you didn't open the port on your firewall.
Also if you test it with IE browser he is very restrictive with origin policy. That mean you have to open the page from server + match the domain name . var host = "ws://example.com:9006/echobot"; // SET THIS TO YOUR SERVER
Open the "inspect element" on browser and check console, reload the page and what error did you get ?
Working fine in local sever.But when uploaded in live server,the server is running :
xxxx@xxxx [~/public_html]# php -q testwebsock.php Server started Listening on: 0.0.0.0:9006 Master socket: Resource id #6
but client.html giving error: WebSocket - status 0 Disconnected - status 3
changed host in client page:
var host = "ws://xxx.com:9006/echobot"; // tried with site name also var host = "ws://IP:9006/echobot"; // tried with IP too
but nothing is working.I am new with socket.So please let me know if I am missing anything. Thanks in advance