sonrac /
laravel-wamp
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Created by PhpStorm. |
||
| 4 | * |
||
| 5 | * @author Donii Sergii <[email protected]> |
||
| 6 | * Date: 10/24/17 |
||
| 7 | * Time: 10:25 AM |
||
| 8 | */ |
||
| 9 | |||
| 10 | namespace sonrac\WAMP\Routers; |
||
| 11 | |||
| 12 | use sonrac\WAMP\Contracts\RPCRouterInterface; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Class RPCRouterInterface |
||
| 16 | * WAMP RPC router. |
||
| 17 | */ |
||
| 18 | class RPCRouter implements RPCRouterInterface |
||
| 19 | { |
||
| 20 | use RouterTrait; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 21 | |||
| 22 | /** |
||
| 23 | * Add new procedure. |
||
| 24 | * |
||
| 25 | * @param string $path |
||
| 26 | * @param string|\Closure $callback |
||
| 27 | * |
||
| 28 | * @return \React\Promise\Promise |
||
| 29 | * |
||
| 30 | * @author Donii Sergii <[email protected]> |
||
| 31 | */ |
||
| 32 | public function addRoute($path, $callback) |
||
| 33 | { |
||
| 34 | $data = $this->prepareCallback($callback); |
||
| 35 | |||
| 36 | return $this->getClientSession()->register($data['prefix'].$path, $data['callback']); |
||
| 37 | } |
||
| 38 | } |
||
| 39 |