wokerman websocket搭配https域名 即wss

来源:互联网 发布:hp p2035n端口 编辑:程序博客网 时间:2024/06/11 11:55

1. 在gateworker的包找到 start_gateway.php

根据手册,需要修改的内容:

$context = array(
    'ssl' => array(
        'local_cert'  => '/etc/ssl/private/1_tkcat_top_bundle.crt', // 或者crt文件
        'local_pk'    => '/etc/ssl/private/2_tkcat.top.key',
        'verify_peer' => false
    )
);
// gateway 进程,这里使用Text协议,可以用telnet测试
$gateway = new Gateway("websocket://0.0.0.0:8282",$context);
// 开启SSL,websocket+SSL 即wss
$gateway->transport = 'ssl';

2. 在html5连接的websocket协议的ip改为  wss://tkcat.top:8282