<?php
use Ratchet\App;
use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;
use Ratchet\Session\SessionProvider;
use Symfony\Component\HttpFoundation\Session\Storage\Handler;
use Symfony\Component\HttpFoundation\Session\Storage\Handler\MemcacheSessionHandler;
use TNTWS\UserConnector;
require dirname(__DIR__) . '/vendor/autoload.php';
$memcache = new Memcache;
$memcache->connect('localhost', 11211);
$server = IoServer::factory(
new HttpServer(
new WsServer(
new SessionProvider(
new UserConnector(),
new MemcacheSessionHandler($memcache)
)
)
),
8080
);
$server->run();
?>