Create PHP WebSocket with SSL -


i have websocket chat on website , added ssl certificate website. when open website http, chat works. when open https it's not working. using javascript client chat ws:// protocol. changed protocol wss:// because of ssl encryption on page, won't work way. here's part of php server code creates socket:

$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); 

how add certificate php socket?

using different function call.

http://php.net/manual/en/function.stream-socket-client.php

and setting correct socket options

http://php.net/manual/en/context.ssl.php


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -