* @param int $keepAliveInterval Seconds between ping calls

This commit is contained in:
Illia Kovalov 2017-09-28 20:06:14 +02:00
parent c03b1b0f56
commit 4aa084c379

View File

@ -97,9 +97,10 @@ class App {
* @param ComponentInterface $controller Your application to server for the route. If not specified, assumed to be for a WebSocket * @param ComponentInterface $controller Your application to server for the route. If not specified, assumed to be for a WebSocket
* @param array $allowedOrigins An array of hosts allowed to connect (same host by default), ['*'] for any * @param array $allowedOrigins An array of hosts allowed to connect (same host by default), ['*'] for any
* @param string $httpHost Override the $httpHost variable provided in the __construct * @param string $httpHost Override the $httpHost variable provided in the __construct
* @param int $keepAliveInterval Seconds between ping calls
* @return ComponentInterface|WsServer * @return ComponentInterface|WsServer
*/ */
public function route($path, ComponentInterface $controller, array $allowedOrigins = array(), $httpHost = null) { public function route($path, ComponentInterface $controller, array $allowedOrigins = array(), $httpHost = null, $keepAliveInterval = 30) {
if ($controller instanceof HttpServerInterface || $controller instanceof WsServer) { if ($controller instanceof HttpServerInterface || $controller instanceof WsServer) {
$decorated = $controller; $decorated = $controller;
} elseif ($controller instanceof WampServerInterface) { } elseif ($controller instanceof WampServerInterface) {
@ -111,7 +112,7 @@ class App {
} }
if ($decorated instanceof WsServer) { if ($decorated instanceof WsServer) {
$decorated->enableKeepAlive($this->_server->loop, 30); $decorated->enableKeepAlive($this->_server->loop, $keepAliveInterval);
} }
if ($httpHost === null) { if ($httpHost === null) {