websocket.ERROR:发生连接错误警告:SessionHandler :: read():会话未激活

时间:2017-11-14 07:57:39

标签: php symfony session websocket ratchet

使用GeniusesOfSymfony / WebSocketBundle和

    Symfony configuration
        framework:
            session:
                handler_id:  session.handler.native_file
                save_path:   "%kernel.root_dir%/../var/sessions/%kernel.environment%"

    Bundle configuration
            gos_web_socket:
                server:
                    port: 8443
                    host: 127.0.0.1
                    router:
                        resources:
                            - "%kernel.root_dir%/../src/AppBundle/Resources/config/pubsub/routing.yml"
                client:
                    firewall: main
                    session_handler: "@session.handler.native_file"
                topics:
                    - "@o4sh_socket.topic_chat"
                pushers:
                    wamp:
                        host: 127.0.0.1
                        port: 8443

Firewall configuration
             main:
                pattern: ^/
                form_login:
                    provider: fos_userbundle
                    csrf_token_generator: security.csrf.token_manager
                    default_target_path: app_homepage
                    always_use_default_target_path: false
                logout:       true
                anonymous:    true
                switch_user: {role: user.switch_user} #use role rights

连接到websocket服务器时生成错误

  

2017-11-14 07:52:25] websocket.ERROR:发生连接错误警告:SessionHandler :: read():在/ srv / www / karli / vendor / symfony / symfony / src /中,会话未激活Symfony / Component / HttpFoundation / Session / Storage / Proxy / SessionHandlerProxy.php第61行{“connection_id”:635,“session_id”:“14425940785a0aa0b983236618314789”}

     

[2017-11-14 07:52:25] websocket.ERROR:发生连接错误警告:SessionHandler :: read():会话在/ srv / www / karli / vendor / symfony / symfony / src中无效/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php第61行{“connection_id”:635,“session_id”:“14425940785a0aa0b983236618314789”}

     

[2017-11-14 07:52:25] websocket.ERROR:发生连接错误提示:未定义的属性:/ srv / www / karli / vendor / gos / web-socket-bundle /中的stdClass :: $ clientStorageId Server / App / WampApplication.php第136行{“connection_id”:635,“session_id”:“14425940785a0aa0b983236618314789”}

     

[2017-11-14 07:52:25] websocket.ERROR:发生连接错误提示:未定义的属性:/ srv / www / karli / vendor / gos / web-socket-bundle /中的stdClass :: $ clientStorageId Server / App / WampApplication.php第136行{“connection_id”:635,“session_id”:“14425940785a0aa0b983236618314789”}

更详细的错误:

websocket.ERROR: Connection error occurred Warning: SessionHandler::read(): Session is not active

1 个答案:

答案 0 :(得分:0)

Okey,终于想通了,就像在文档中(花时间找到它),你不能使用棘轮的原生会话处理程序,所有我必须做的,是:

session_handler: "@session.handler.pdo"

一切都按预期工作。