PHPDaemon\SockJS\Application::wsHandler PHP Method

wsHandler() public method

wsHandler
public wsHandler ( object $ws, string $path, object $client, callable $state ) : boolean
$ws object [@todo description]
$path string [@todo description]
$client object [@todo description]
$state callable [@todo description]
return boolean
    public function wsHandler($ws, $path, $client, $state)
    {
        $e = explode('/', $path);
        $method = array_pop($e);
        $serverId = null;
        $sessId = null;
        if ($method !== 'websocket') {
            return false;
        }
        if (sizeof($e) < 3 || !isset($e[sizeof($e) - 2]) || !ctype_digit($e[sizeof($e) - 2])) {
            return false;
        }
        $sessId = array_pop($e);
        $serverId = array_pop($e);
        $path = implode('/', $e);
        $client = new WebSocketConnectionProxy($this, $client);
        $route = $ws->getRoute($path, $client, true);
        if (!$route) {
            $state($route);
            return false;
        }
        $route = new WebSocketRouteProxy($this, $route);
        $state($route);
        return true;
    }