【问题标题】:websocket.ERROR: Connection error occurred Warning: SessionHandler::read(): Session is not activewebsocket.ERROR:发生连接错误警告:SessionHandler::read():会话未激活
【发布时间】:2018-04-27 02:01:44
【问题描述】:

将 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"}

更详细的错误:

【问题讨论】:

    标签: php symfony session websocket ratchet


    【解决方案1】:

    好吧,终于弄明白了,就像在文档中一样(花了一些时间找到它),您不能将本机会话处理程序与棘轮一起使用,我所要做的就是:

    session_handler: "@session.handler.pdo"

    一切都按预期进行。

    【讨论】:

      猜你喜欢
      • 2017-02-20
      • 1970-01-01
      • 2017-05-10
      • 2022-11-09
      • 1970-01-01
      • 1970-01-01
      • 2019-12-24
      • 2023-03-15
      • 2021-10-23
      相关资源
      最近更新 更多