Issues (61)

src/Routers/PubSubRouter.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 *
5
 * @author Donii Sergii <[email protected]>
6
 * Date: 10/24/17
7
 * Time: 11:05 AM
8
 */
9
10
namespace sonrac\WAMP\Routers;
11
12
use sonrac\WAMP\Contracts\PubSubRouterInterface;
13
14
/**
15
 * Class PubSubRouter
16
 * Publisher/subscribers router.
17
 */
18
class PubSubRouter implements PubSubRouterInterface
19
{
20
    use RouterTrait;
0 ignored issues
show
The trait sonrac\WAMP\Routers\RouterTrait requires the property $wampRouter which is not provided by sonrac\WAMP\Routers\PubSubRouter.
Loading history...
21
22
    /**
23
     * Add subscriber.
24
     *
25
     * @param string          $path     Route path
26
     * @param \Closure|string $callback Callback
27
     *
28
     * @return \React\Promise\Promise
29
     *
30
     * @author Donii Sergii <[email protected]>
31
     */
32 1
    public function addRoute($path, $callback)
33
    {
34 1
        $data = $this->prepareCallback($callback);
35
36 1
        return $this->getClientSession()->subscribe($data['prefix'].$path, $data['callback']);
37
    }
38
}
39