lizhichao / one

A minimalist high-performance php framework that supports the [swoole | php-fpm] environment
Apache License 2.0
884 stars 127 forks source link

websocket下可以使用session吗,该怎么使用呢 #3

Closed naivman closed 5 years ago

naivman commented 5 years ago

如题

lizhichao commented 5 years ago

可以 , 在控制器$this->session就是 和普通的http请求一模一样。唯一需要注意的是重写一下父类的方法onHandShake

public function onHandShake(\swoole_http_request $request, \swoole_http_response $response)
    {
        return parent::onHandShake($request, $response);
    }