The SessionProvider will attach a Symfony2 Session object to each incoming Connection object that will give you read-only access to the session data from your website. The SessionProvider will not work with any of the Native* session handlers. It is suggested you use choose one of the following Symfony Custom Save Handlers:
In order to access your session data in Ratchet, you must also use the same Symfony Session Handler on you website. Below is a network diagram of how the various connections interact to access data:

Important: Sessions through WebSockets work as they do through a traditional webserver; a cookie is set and transmitted in each request header.
This means that your website and your WebSocket server both must have access to the cookie.
In order for session data to be shared between your website and your WebSocket server they must be on the same domain.
You can achieve this by either hosting them on the same domain and different ports, such as mydomain.com:80 (for website) and mydomain.com:8080 (for WebSockets).
If you choose to host the WebSocket server on a sub-domain (websocket.mydomain.com:80) make sure to have your website's php.ini file configured like this:
session.cookie_domain = ".mydomain.com"
As found in the API Docs: Triggered events are propagated through a MessageComponentInterface object passed to the __construct.
None.
<?php
// Your shell script
use Ratchet\Session\SessionProvider;
use Ratchet\WebSocket\WsServer;
use Ratchet\Server\IoServer;
use Symfony\Component\HttpFoundation\Session\Storage\Handler;
$memcache = new Memcache;
$memcache->connect('localhost', 11211);
$session = new SessionProvider(
new MyApp
, new Handler\MemcacheSessionHandler($memcache)
);
// Make sure to run as root
$server = IoServer::factory(new WsServer($session));
$server->run();
<?php
// Inside your MyApp class
public function onOpen($conn) {
$conn->send('Hello ' . $conn->Session->get('name'));
}