ThinkPHP5.0的think-swoole 开启WebSocket的SSL支持 使用wss连接

361 阅读1分钟

相关文章:ThinkPHP5.0结合Swoole开发WebSocket在线聊天

                  Swoole WebSocket开启SSL支持 使用wss连接

找到think-swoole的Server.php:

在构造方法中增加一个WebSocket服务类型,调用mode和sockType参数:

case 'ssl':
     $this->swoole = new Websocket($this->host, $this->port, $this->mode, $this->sockType);
break;

 

 控制器中配置serverType 、mode和sockType三个参数: