阅读背景:

php : tp框架swoole实现websocket,wss_曲帅的博客_tp框架websocket

来源:互联网 
class Swoole extends \think\swoole\Server
{
    protected static $token;
    protected $host = '0.0.0.0';
    protected $port = 9503;
    //protected $serverType = 'socket';
    protected $serverType = 'ssl';
    protected static $uid = '';
    protected $mode = SWOOLE_PROCESS;
    protected $sockType = SWOOLE_SOCK_TCP | SWOOLE_SSL;
    protected $option = [
        'worker_num' => 4, // 设置启动的Worker进程数
        'daemonize' => true, //守护进程化。
        'backlog' => 128, //Listen队列长度,
        'dispatch_mode' => 2,
        'heartbeat_check_interval' => 5, //5秒跟新
        'heartbeat_idle_time' => 100,    //连接超时
        'ssl_cert_file' => "/www/cert/wss.qhoo.top.pem",
        'ssl_key_file'  => "/www/cert/wss.qhoo.top.key"
    ];

    //连接
    public function onOpen( $server,  $req)
    {
        //fd:进入ws给的id每次进入都会变
        $fd = $req->fd;
        //token={
   class Swoole extends \think\swoole\Server
{
   



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: