zhoudw
2021-12-21 14523c96e2aef9ab466a90f670569c1f152af696
ws_server.php
@@ -28,6 +28,13 @@
        ]);
        if (!$this->redis) {
            $this->redis = new Redis();
            $this->redis->connect($this->redis_config['host'],$this->redis_config['port'] );
            $host  = $this->server_config['allow_ip'];
            $keyList = $this->redis->keys("*{$host}*");
            foreach ($keyList as $key => $value) {
                $this->redis->del($value);
            }
            $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";