jablonka.czprosek.czf

freenet-router

Subversion Repositories:
[/] [trunk/] [freenet-router/] [var/] [www/] [freenet-router/] [Framework/] [Libraries/] [MessageBus/] [ReactSocketPuller.php] - Blame information for rev 2

 

Line No. Rev Author Line
12simandl<?php
2 
3namespace Phem\Libraries\MessageBus;
4 
5use React\EventLoop\LoopInterface;
6use React\Socket\ConnectionInterface;
7use React\Socket\Server;
8 
9/**
10 * @author Jakub PetrŞílka <petrzilka@czweb.net>
11 */
12class ReactSocketPuller extends WebsocketPuller
13{
14 
15 protected $msgBus;
16 protected $server;
17 
18 public function __construct(LoopInterface $loop, MessageBus $msgBus)
19 {
20 $this->msgBus = $msgBus;
21 $this->server = new Server($loop);
22 $this->server->on("connection", array($this, 'onConnection'));
23 }
24 
25 public function onConnection(ConnectionInterface $conn)
26 {
27 $conn->on("data", function($data){
28 $this->msgBus->onNotify($data);
29 });
30 }
31 
32 public function listen($ip, $port)
33 {
34 $this->server->listen($port, $ip);
35 }
36 
37}

Powered by WebSVN 2.2.1