zhoudw
2021-12-21 f8e6e8175bec8a6bff0fb8eb0f3fac7cddbb1e78
初始化
1 files modified
2 ■■■■■ changed files
ws_server.php 2 ●●●●● patch | view | raw | blame | history
ws_server.php
@@ -26,6 +26,7 @@
            'enable_coroutine'      => true,
            'task_enable_coroutine' => true
        ]);
        $this->server->on('WorkerStart', function (Swoole\WebSocket\Server $server) {
        if (!$this->redis) {
            $this->redis = new Redis();
            $this->redis->connect($this->redis_config['host'],$this->redis_config['port'] ); 
@@ -37,6 +38,7 @@
            $this->redis->del("{$host}*");
            $this->redis->close();
        }
        });
        $this->server->on('start', function (Swoole\WebSocket\Server $server) {
            echo "Websocket Server is started at ws://".$this->server_config['host'].":".$this->server_config['port']."\n";
        });