PHPDaemon\Servers\WebSocket\Pool::addRoute PHP Method

addRoute() public method

Adds a route if it doesn't exist already.
public addRoute ( string $path, callable $cb ) : boolean
$path string Route name.
$cb callable Route's callback.
return boolean Success.
    public function addRoute($path, $cb)
    {
        $routeName = ltrim($path, '/');
        if (isset($this->routes[$routeName])) {
            Daemon::log(__METHOD__ . ': Route \'' . $path . '\' is already defined.');
            return false;
        }
        $this->routes[$routeName] = $cb;
        return true;
    }