symfony - Symfony2 and ClankBundle: cannot share session -
i using symfony2 clankbundle websocket funciontality. followed instructions reported here (pdosessionhandler) , here (clank session sharing), still not able information store inside session.
i still using built-in debug server provided symfony runs on http://127.0.0.1:8000
my parameters.yml
parameters: clank_host: 127.0.0.1 clank_port: 8080
my config.yml
framework: session: handler_id: session.handler.pdo clank: web_socket_server: port: "%clank_port%" host: "%clank_host%" session_handler: session.handler.pdo
in controller:
$session = $this->get('session'); $session->set('user_token', $user->getid() );
in topic service:
public function onsubscribe(conn $conn, $topic) { file_put_contents('debug.txt', "onsubscribe" .$conn->resourceid . " connected" . " ".$conn->session->get('user_token'). php_eol, file_append | lock_ex); // ... }
and script in page:
var myclank = clank.connect("ws://127.0.0.1:8080"); myclank.on("socket/connect", function(session){ console.log("successfully connected!"); session.subscribe("topicservice/channel", function(uri, payload){ console.log("received message"); }); // ... })
bit still, when users connect , subscribe, $conn->session->get('user_token')
returns null.
any ideas on doing wrong? thank in advance
i found problem was.
symfony built-in server , clank server both run on 127.0.0.1
, accessing browser localhost
.
it seems these considered 2 different domains. know.