When I logged in into my website, there are 3 items set into the session like this
$_SESSION['language'] = 'US';
$_SESSION['account'] = array();
$_SESSION['account']['id'] = 1;
$_SESSION['account']['session'] = session_id()
Then, when I go to the admin panel and do a var_dump() of $_SESSION all the 3 items in te session is shown. So far so good.
But when I connect to my own created websocket server it reads the $_SESSION['language'] but it can't read the
$_SESSION['account']
So this is what I am doing: Send the cookie (PHPSESSID) in the header when connecting to the websocket stream. Then just before handshaking I used the following code which is only var_dumping the "language" and NOT the "account"
if (preg_match("/PHPSESSID=(.*?)(?:;|
)/", $data, $match))
{
session_id($matches[1]);
var_dump($_SESSION);
session_write_close();
}
So to make a short story: It reads the $_SESSION['language'] but it doesn't find the $_SESSION['account'] before handshaking. Does anybody know more about this? (And i am sure the sessions are started and they aren't destroy somewhere)