作者 何书鹏

3

@@ -19,7 +19,14 @@ class Server @@ -19,7 +19,14 @@ class Server
19 public function index(){ 19 public function index(){
20 header("Access-Control-Allow-Origin: *"); 20 header("Access-Control-Allow-Origin: *");
21 // PHPSocketIO服务 21 // PHPSocketIO服务
22 - $sender_io = new SocketIO(2120); 22 + $context = array(
  23 + 'ssl' => array(
  24 + 'local_cert' => '/usr/local/nginx/cert/chengyigou.cn/chengyigou.cn.crt',
  25 + 'local_pk' => '/usr/local/nginx/cert/chengyigou.cn/chengyigou.cn.key',
  26 + 'verify_peer' => false,
  27 + )
  28 + );
  29 + $sender_io = new SocketIO(2120,$context);
23 // 客户端发起连接事件时,设置连接socket的各种事件回调 30 // 客户端发起连接事件时,设置连接socket的各种事件回调
24 $sender_io->on('connection', function($socket){ 31 $sender_io->on('connection', function($socket){
25 // 当客户端发来登录事件时触发 32 // 当客户端发来登录事件时触发