0
votes

using GeniusesOfSymfony/WebSocketBundle with

    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

generates me error when connecting to websocket server

2017-11-14 07:52:25] websocket.ERROR: Connection error occurred Warning: SessionHandler::read(): Session is not active in /srv/www/karli/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php line 61 {"connection_id":635,"session_id":"14425940785a0aa0b983236618314789"}

[2017-11-14 07:52:25] websocket.ERROR: Connection error occurred Warning: SessionHandler::read(): Session is not active in /srv/www/karli/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php line 61 {"connection_id":635,"session_id":"14425940785a0aa0b983236618314789"}

[2017-11-14 07:52:25] websocket.ERROR: Connection error occurred Notice: Undefined property: stdClass::$clientStorageId in /srv/www/karli/vendor/gos/web-socket-bundle/Server/App/WampApplication.php line 136 {"connection_id":635,"session_id":"14425940785a0aa0b983236618314789"}

[2017-11-14 07:52:25] websocket.ERROR: Connection error occurred Notice: Undefined property: stdClass::$clientStorageId in /srv/www/karli/vendor/gos/web-socket-bundle/Server/App/WampApplication.php line 136 {"connection_id":635,"session_id":"14425940785a0aa0b983236618314789"}

more detailed error:

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

1

1 Answers

0
votes

Okey, finally figured it out, as in documentation (took time to find it), you cannot use native session handlers with ratchet, all i had to do, was:

session_handler: "@session.handler.pdo"

and everything works as expected.