jablonka.czprosek.czf

freenet-router

Subversion Repositories:
[/] [trunk/] [freenet-router/] [var/] [www/] [freenet-router/] [socket.run.php] - Blame information for rev 2

 

Line No. Rev Author Line
12simandl<?php
2 
3/**
4 * @author Jakub PetrŞílka <petrzilka@czweb.net>
5 */
6require_once('init.php');
7 
8use Phem\Core\Collection;
9use Phem\Environment\Application;
10use Phem\Libraries\MessageBus\MessageBus;
11use Ratchet\Http\HttpServer;
12use Ratchet\Server\IoServer;
13use Ratchet\WebSocket\WsServer;
14use React\EventLoop\Factory;
15use React\Socket\Server;
16 
17$loop = Factory::create();
18 
19$msgBus = new MessageBus();
20 
21// Listen for the application notifications
22$pullerClassName = ROOT_NAMESPACE."\\Libraries\\MessageBus\\"
23 . WEBSOCKET_PULLER_MODE."Puller";
24if (class_exists($pullerClassName))
25{
26 $puller = new $pullerClassName($loop,$msgBus);
27 $puller->listen(WEBSOCKET_PULLER_BIND_ADDR,WEBSOCKET_PULLER_PORT);
28}
29else if (strtolower(WEBSOCKET_PULLER_MODE) != "disabled")
30{
31 throw new Exception("Unsupported mode given by WEBSOCKET_PULLER_MODE");
32}
33 
34// Listen for the websocket connections
35$webSock = new Server($loop);
36$webSock->listen(WEBSOCKET_PORT, WEBSOCKET_BIND_ADDR);
37$server = new IoServer(new HttpServer(new WsServer($msgBus)), $webSock);
38 
39// Clear previous application scope user cache
40Application::setUsers(new Collection());
41 
42$loop->run();

Powered by WebSVN 2.2.1