Swoole-src: Sessions support?

Created on 14 Jun 2018  ·  3Comments  ·  Source: swoole/swoole-src

PHP process is designed to handle a single request with a single session context. In case of Swoole, single process will be handling multiple requests, each requiring its own session context.

Is Swoole completely incompatible with PHP sessions? Functions session_* cannot be used, correct?

How to implement sessions with Swoole?

question wontfix

Most helpful comment

All 3 comments

Yes, you must implement it by yourself.
PHP session depends on $_COOKIE and use the files to save the session context.
You can create a session table in the database, use $response->setcookie to give the client a random token, save the token in the database, through $request->cookies attribute to get client session-token and find it in the database.
You can see the repo https://github.com/swoft-cloud/swoft-session, Or just use swoft framework.

@twose and @huangzhhui,
Thanks for the quick response!
Closing.

Was this page helpful?
0 / 5 - 0 ratings