{"action":"created","issue":{"url":"https://api.github.com/repos/GeniusesOfSymfony/WebSocketBundle/issues/46","labels_url":"https://api.github.com/repos/GeniusesOfSymfony/WebSocketBundle/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/GeniusesOfSymfony/WebSocketBundle/issues/46/comments","events_url":"https://api.github.com/repos/GeniusesOfSymfony/WebSocketBundle/issues/46/events","html_url":"https://github.com/GeniusesOfSymfony/WebSocketBundle/issues/46","id":96569806,"number":46,"title":"ClientManipulatorInterface","user":{"login":"rtoledof","id":1178862,"avatar_url":"https://avatars.githubusercontent.com/u/1178862?v=3","gravatar_id":"","url":"https://api.github.com/users/rtoledof","html_url":"https://github.com/rtoledof","followers_url":"https://api.github.com/users/rtoledof/followers","following_url":"https://api.github.com/users/rtoledof/following{/other_user}","gists_url":"https://api.github.com/users/rtoledof/gists{/gist_id}","starred_url":"https://api.github.com/users/rtoledof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtoledof/subscriptions","organizations_url":"https://api.github.com/users/rtoledof/orgs","repos_url":"https://api.github.com/users/rtoledof/repos","events_url":"https://api.github.com/users/rtoledof/events{/privacy}","received_events_url":"https://api.github.com/users/rtoledof/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-07-22T13:36:25Z","updated_at":"2015-07-24T17:00:45Z","closed_at":null,"body":"Hello I'm trying to integrate the bundle in my project to use the real time notification. I need to get logged user to get information related to this user. I followed step by step the all configuration in the bundle but when I try to  get the user using $user = $this->clientManipulator->getClient($connection) every time the function get me the anonymous user. \r\n\r\nHere is my configuration.\r\n\r\nGOS Configuration:\r\ngos_web_socket:\r\n    server:\r\n        port: \"%clank_port%\"   #The port the socket server will listen on\r\n        host: \"%clank_host%\"   #The host ip to bind to\r\n        router:\r\n          resources:\r\n            - @SomeBundle/Resources/config/pubsub/routing.yml\r\n\r\n    shared_config: false\r\n\r\n    topics:\r\n      - @some.topic_test_service\r\n\r\n    client:\r\n      firewall: backend_secure_area\r\n      session_handler: @session.handler.pdo\r\n      storage:\r\n        driver: @gos_web_socket.client_storage.driver.redis\r\n        decorator: @gos_web_socket.client_storage.doctrine.decorator\r\n\r\nSNC Redis configuration\r\n\r\nsnc_redis:\r\n  clients:\r\n    ws_client:\r\n      type: predis\r\n      alias: client_storage.driver #snc_redis.client_storage.driver\r\n      dsn: redis://127.0.0.1/2\r\n      logging: %kernel.debug%\r\n   options:\r\n     profile: 2.2\r\n     connection_timeout: 10\r\n     read_write_timeout: 30\r\n\r\nDoctrine Cache Configuration\r\n\r\ndoctrine_cache:\r\n    providers:\r\n        redis_cache:\r\n            redis:\r\n                host: 127.0.0.1\r\n                port: 6379\r\n                database: 3\r\n        websocket_cache_client:\r\n            type: redis\r\n            alias: gos_web_socket.client_storage.driver.redis\r\n\r\nSession Handler configuration\r\n\r\n    pdo:\r\n      class: PDO\r\n      arguments:\r\n          dsn: mysql:host=%database_host2%;dbname=%database_name2%\r\n          user: %database_user2%\r\n          password: %database_password2%\r\n      calls:\r\n          - [ setAttribute, [3, 2] ] # \\PDO::ATTR_ERRMODE, \\PDO::ERRMODE_EXCEPTION\r\n\r\n  session.handler.pdo:\r\n      class:     Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\PdoSessionHandler\r\n      arguments: [@pdo, {lock_mode: 0}]\r\n\r\nGOS client Store driver configuration\r\ngos_web_scocket.client_storage.driver.predis:\r\n    class: Gos\\Bundle\\WebSocketBundle\\Client\\Driver\\PredisDriver\r\n    arguments:\r\n        - @snc_redis.client_storage.driver_client\r\n\r\nMy service\r\n\r\nsome.topic_test_service:\r\n    class: Backend\\SomeBundle\\Topic\\SomTopic\r\n    arguments: [ @gos_web_socket.websocket.client_manipulator, @some.service]\r\n\r\nRouting Channel configuration\r\nsome_topic:\r\n  channel: some/channel\r\n  handler:\r\n    callback: 'backend.some'\r\n\r\nTopic class with periodic call\r\nclass SomeTopic implements TopicInterface, TopicPeriodicTimerInterface\r\n{\r\n\r\n    /**\r\n     * @var TopicPeriodicTimer\r\n     */\r\n    protected $periodicTimer;\r\n    /**\r\n     * @var ClientManipulatorInterface\r\n     */\r\n    protected $clientManipulator;\r\n\r\n    /**\r\n     * @var SomeService\r\n     */\r\n    protected $SomeService;\r\n    private $i;\r\n\r\n    /**\r\n     *\r\n     * param [ mixed $args [, $... ]]\r\n     * @param ClientManipulatorInterface $clientManipulatorInterface\r\n     * @param SomeService $transactionService\r\n     * @param ContainerInterface $container\r\n     * @internal param TokenStorageInterface $token\r\n     * @link http://php.net/manual/en/language.oop5.decon.php\r\n     */\r\n    function __construct(ClientManipulatorInterface $clientManipulatorInterface,\r\n                         SomeService $someService)\r\n    {\r\n        $this->clientManipulator = $clientManipulatorInterface;\r\n        $this->someService = $someService;\r\n        $this->i = 0;\r\n    }\r\n\r\n\r\n    /**\r\n     * @param  ConnectionInterface $connection\r\n     * @param  Topic $topic\r\n     * @param WampRequest $request\r\n     */\r\n    public function onSubscribe(ConnectionInterface $connection, Topic $topic, WampRequest $request)\r\n    {\r\n        \r\n        $user = $this->clientManipulator->getClient($connection);\r\n        $topic->broadcast(\"Hello World \".$user);\r\n    }\r\n\r\n    /**\r\n     * @param  ConnectionInterface $connection\r\n     * @param  Topic $topic\r\n     * @param WampRequest $request\r\n     */\r\n    public function onUnSubscribe(ConnectionInterface $connection, Topic $topic, WampRequest $request)\r\n    {\r\n        //this will broadcast the message to ALL subscribers of this topic.\r\n        $topic->broadcast(['msg' => $connection->resourceId . \" has left \" . $topic->getId()]);\r\n    }\r\n\r\n    /**\r\n     * @param  ConnectionInterface $connection\r\n     * @param  Topic $topic\r\n     * @param WampRequest $request\r\n     * @param $event\r\n     * @param  array $exclude\r\n     * @param  array $eligible\r\n     */\r\n    public function onPublish(ConnectionInterface $connection, Topic $topic, WampRequest $request, $event, array $exclude, array $eligible)\r\n    {\r\n        /*\r\n            $topic->getId() will contain the FULL requested uri, so you can proceed based on that\r\n\r\n            if ($topic->getId() == \"acme/channel/shout\")\r\n               //shout something to all subs.\r\n        */\r\n        $topic->broadcast([\r\n            'msg' => $event\r\n        ]);\r\n    }\r\n\r\n    /**\r\n     * @return string\r\n     */\r\n    public function getName()\r\n    {\r\n        return \"backend.some\";\r\n    }\r\n\r\n    /**\r\n     * @param Topic $topic\r\n     *\r\n     * @return mixed\r\n     */\r\n    public function registerPeriodicTimer(Topic $topic)\r\n    {\r\n        $this->periodicTimer->addPeriodicTimer($this, 'some', 10, function() use ($topic){           \r\n            $topic->broadcast(\"Hello World \".$this->i++);\r\n        });\r\n\r\n        //exist\r\n        $this->periodicTimer->isPeriodicTimerActive($this, 'some'); // true or false\r\n\r\n        //remove\r\n        $this->periodicTimer->cancelPeriodicTimer($this, 'some');\r\n    }\r\n\r\n    /**\r\n     * @param TopicPeriodicTimer $periodicTimer\r\n     */\r\n    public function setPeriodicTimer(TopicPeriodicTimer $periodicTimer)\r\n    {\r\n        $this->periodicTimer = $periodicTimer;\r\n    }\r\n}\r\n\r\nWhen the websocket send the information about the user all time the user is anon-210954636255afb7a3535fe598094366 and I'm logged with other user.\r\n\r\nAny idea??\r\n "},"comment":{"url":"https://api.github.com/repos/GeniusesOfSymfony/WebSocketBundle/issues/comments/124579364","html_url":"https://github.com/GeniusesOfSymfony/WebSocketBundle/issues/46#issuecomment-124579364","issue_url":"https://api.github.com/repos/GeniusesOfSymfony/WebSocketBundle/issues/46","id":124579364,"user":{"login":"rtoledof","id":1178862,"avatar_url":"https://avatars.githubusercontent.com/u/1178862?v=3","gravatar_id":"","url":"https://api.github.com/users/rtoledof","html_url":"https://github.com/rtoledof","followers_url":"https://api.github.com/users/rtoledof/followers","following_url":"https://api.github.com/users/rtoledof/following{/other_user}","gists_url":"https://api.github.com/users/rtoledof/gists{/gist_id}","starred_url":"https://api.github.com/users/rtoledof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rtoledof/subscriptions","organizations_url":"https://api.github.com/users/rtoledof/orgs","repos_url":"https://api.github.com/users/rtoledof/repos","events_url":"https://api.github.com/users/rtoledof/events{/privacy}","received_events_url":"https://api.github.com/users/rtoledof/received_events","type":"User","site_admin":false},"created_at":"2015-07-24T17:00:45Z","updated_at":"2015-07-24T17:00:45Z","body":"I change it for My IP address and it doesn't work.\r\n\r\nI'm using nginx and I've a virtual host name someweb.local. In my local machine I change the hosts file and declare the 127.0.0.1 is someweb.local. In other machine I changed the hosts file and indicate my IP is someweb.local for access using the domain name in the other machine. I opened the url in both machines and both are connected to the websocket but the ClientManipulator gave me the anon user in both clients. The socket send the information for both browsers but in both case the user is anonymous even if in both clients are login with the different users.\r\n\r\nI think the clank_host is not the problem.\r\n\r\nDebugging the application I showed the client manipulator class is initialize in three times and in the firth he have the logged user but in the others the user disappear and I only require the service a time. That may be the problem? If it is the problem How can I initialize only one time or the bundle initialize more times the ClientManipulator?? "}}