Session 无Symfony会话的棘轮

Session 无Symfony会话的棘轮,session,websocket,session-cookies,ratchet,Session,Websocket,Session Cookies,Ratchet,我想使用ratchet而不使用Symfony会话,并在web应用程序和ratchet之间使用php处理程序处理会话。但它不起作用 我的会话处理代码: 运行服务器:session.php` ini_set('session.save_handler', 'memcached' ); ini_set('session.save_path', 'localhost:11211' ); use Ratchet\Server\IoServer; use Ratchet\WebSocket\WsServe

我想使用ratchet而不使用
Symfony
会话,并在web应用程序和ratchet之间使用
php
处理程序处理会话。但它不起作用

我的会话处理代码:

运行服务器:session.php`

ini_set('session.save_handler', 'memcached' );
ini_set('session.save_path', 'localhost:11211' );

use Ratchet\Server\IoServer;
use Ratchet\WebSocket\WsServer;
use MyApp\Chat;

    require dirname(__DIR__) . '/vendor/autoload.php';
    require __DIR__ . './../src/MyApp/Chat.php';

    $server = IoServer::factory(
    new WsServer(
    new Chat()
    )
    , 8080
);

    $server->run();
我的应用程序:chat.php

public function onOpen(ConnectionInterface $conn) {

        // Store the new connection to send messages to later
        $this->clients->attach($conn);

        session_start();

        echo "New connection! ({$conn->resourceId})\n";
        $conn->send('Hello ' . session_id());
客户端:

ini_set('session.save_handler', 'memcached' );
ini_set('session.save_path', 'localhost:11211' );

session_start();

require __DIR__ . './../server/vendor/autoload.php';

$_SESSION['name'] = $_GET['name'];

if (isset($_SESSION['name'])) {
    var_dump($_SESSION['name']);
} else {
    echo 'Not set!!!';
}
我的请求url:
localhost/myfile/?name=shahrokh

这不起作用。从:

为了在Ratchet中访问会话数据,还必须使用 您网站上的Symfony会话处理程序相同

还可以看到这个问题:好的,您必须从symfony视图启动会话才能在ratchet中访问它,即使您正在使用symfony会话处理程序。