Git Repository Public Repository

namibia

URLs

Copy to Clipboard
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php

#-> Root ourselves.
chdir(dirname(__DIR__));
date_default_timezone_set ( 'Africa/Johannesburg' );

#-> Prepare workspace.
ini_set('memory_limit','512M');
require_once 'init_autoloader.php';
require_once 'SocketApp.php';


#-> Get the socket server running.
#-> Server loop and our router.
$server = React\EventLoop\Factory::create();
$router = new Daemon\Damien();

#-> ZeroMQ binding.
$context = new React\ZMQ\Context($server);
$pull    = $context->getSocket(ZMQ::SOCKET_PULL);
$pull->bind('tcp://127.0.0.1:90');
$pull->on('message', array($router, 'onQueueMessage'));

#-> Websocket binding.
$webSock = new \React\Socket\Server($server);
$webSock->listen(91, '0.0.0.0');
$webServer = new Ratchet\Server\IoServer(
	new Ratchet\Http\HttpServer(
		new Ratchet\WebSocket\WsServer(
			$router
		)
	),
	$webSock
);

#-> Awesomeness.
$server->run();

Commits for namibia/daemon/SocketServer.php

Diff revisions: vs.
Revision Author Commited Message
df0489 ... Mark Fri 14 Oct, 2016 10:01:00 +0000

initial commit