Questions › Your php websocket succeeded on localhost, but failed on remote server

4290 asked on 10th Jun 2017

Dear Saran,

I made a little modification to yours on Thanks for it. It successfully worked at first for the localhost on XAMPP. It was great. But, it was blocked on a remote server nested in WHOIS.COM, a major hosting company. All failed!!! 1. Browser: Chrome, Firefox 2. Hosting Company: WHOIS.COM 3. Service Plan: VPS 4. Tried IPs: 80, 8080, 2028 5. Tried Hosts: localhost,, 132.131.312.23:2028 6. domain ip:132.131.312.23:2028 (not on service now) 7.

Please see what's wrong!


 var n = 'ws://localhost:80/ph/server.php'; 
   socket = new WebSocket(n);  


  $host = 'localhost'; 
  $port = 80;
  $socketpath = 'ph/server.php'; 
  $sob = socket_bind($socket, '', $port);
"WebSocket-Origin: $host/rn" .
"WebSocket-Location: ws://$host:$port/$socketpath/rn".

I want to get through this problem even if I got a detour with another easy source code from

Please see.


    Can You Answer this? Help us answer the question!

      • Answer
      Supports basic Markdown syntax. Excluded syntaxes (Headers, Lists, Blockquotes, Table, Images)