easy-swoole / easyswoole

swoole,easyswoole,swoole framework
https://www.easyswoole.com/
Apache License 2.0
4.73k stars 511 forks source link

Websocket使用了onClose事件后如何区分是否为ws连接? #530

Closed kyour-cn closed 2 years ago

kyour-cn commented 2 years ago

在Http和Websocket共存的项目,使用了onClose事件监听。 当有http请求结束也会触发onClose,请问我该如何区分该断开的连接是什么类型呢?

kyour-cn commented 2 years ago
        if ($ws instanceof \Swoole\Http\Server) {
            //去除http请求
            return;
        }
YiwanGi commented 2 years ago
        if ($ws instanceof \Swoole\Http\Server) {
            //去除http请求
            return;
        }

QN68PA}XP1}Z1J KVH RLHR