title: Create PHP WebSocket with SSL
body: <p>I have a websocket chat on my website and I recently added SSL certificate to my website. When I open my website with <code>http</code>, chat works. When I open it with <code>https</code> it's not working. I am using javascript as client for my chat with <code>ws://</code> protocol. I changed that protocol to <code>wss://</code> because of SSL encryption on my page, but it won't work that way. Here's part of my PHP server code that creates the socket:</p>
  
  <pre><code>$host = 'localhost'; 
  $port = '9000'; 
  $null = NULL;
  
  $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
  socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1);
  
  socket_bind($socket, 0, $port);
  
  socket_listen($socket);
  
  $clients = array($socket);
  </code></pre>