You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Yii2 and I'm trying to figure out how I could use this library with an existing app. Could you point to an example of a shared session/cookie system? A simple example would be to login via the main app and leverage the same cookie and session to skip authorization of a websocket session.
Great work btw. Thanks!
The text was updated successfully, but these errors were encountered:
//-----------------------------------read session opera start----------------------------------------------
$cookies = $socket->handshake['headers']['cookie']; // hare get client header is trouble,need to grep,otherwise dot‘t know has the array information。
// string to cookie array。phpsocketIO not found the functions。
$cookiesList = explode(';', $cookies);
$cookieResult = [];
foreach ($cookiesList as $value) {
list($k, $v) = explode('=', $value);
$k = trim($k);
$v = trim($v);
$cookieResult[$k] = $v;
}
//here can use session_save_path function get the session path info,but redis or memcached need other method。
$sessionStr = file_get_contents("/tmp/sess_{$cookieResult['PHPSESSID']}");
$result = session_decode($sessionStr);
var_dump($_SESSION);
echo "\n";
//-----------------------------------read session opera end----------------------------------------------
//-----------------------------------save session opera start----------------------------------------------
$_SESSION['bbb'] = 'ccc';
$sessionString = session_encode();
file_put_contents("/tmp/sess_{$cookieResult['PHPSESSID']}", $sessionString, LOCK_EX);
//-----------------------------------save session opera end----------------------------------------------
I'm using Yii2 and I'm trying to figure out how I could use this library with an existing app. Could you point to an example of a shared session/cookie system? A simple example would be to login via the main app and leverage the same cookie and session to skip authorization of a websocket session.
Great work btw. Thanks!
The text was updated successfully, but these errors were encountered: