public function onOpen(\Swoole\WebSocket\Server $server, \Swoole\Http\Request $request)
    {
        // echo "[websocket][onopen]server: handshake success with fd{$request->fd} url={$request->server['request_uri']}?{$request->server['query_string']}\n";

        // Compat fpm server
        $this->_compatFPM($request);

        // print_r(self::$websocketFrameContext);

        // filter websocket router class
        // route struct: [$controller_name, $controller_class]
        $controller_class = (\ePHP\Core\Route::init())->findWebSocketRoute();
        if ( !empty($controller_class) ) {
            // Save websocket connection Context
            self::$websocketFrameContext[$request->fd] = [
                'get'    => $_GET,
                'cookie' => $_COOKIE,
                'controller_class' => $controller_class
            ];

            // echo 'pid='. getmypid() . ', fd=' . implode(',', array_keys(self::$websocketFrameContext))
            //     . ', connections=' . count($this->server->connections) . "\n";

            call_user_func([new $controller_class(), 'onOpen'], $server, $request);
        }

    }
public function onOpen(\Swoole\WebSocket\Server $server, \Swoole\Http\Request $request)
    {
        // echo "[websocket][onopen]server: handshake success with fd{$request->fd} url={$request->server['request_uri']}?{$request->server['query_string']}\n";

        // Compat fpm server
        $this->_compatFPM($request);

        // print_r(self::$websocketFrameContext);

        // filter websocket router class
        // route struct: [$controller_name, $controller_class]
        $controller_class = (\ePHP\Core\Route::init())->findWebSocketRoute();
        if ( !empty($controller_class) ) {
            // Save websocket connection Context
            self::$websocketFrameContext[$request->fd] = [
                'get'    => $_GET,
                'cookie' => $_COOKIE,
                'controller_class' => $controller_class
            ];

            // echo 'pid='. getmypid() . ', fd=' . implode(',', array_keys(self::$websocketFrameContext))
            //     . ', connections=' . count($this->server->connections) . "\n";

            call_user_func([new $controller_class(), 'onOpen'], $server, $request);
        }

    }
public function onOpen ( \ Swoole \ WebSocket \ Server $ server , \ Swoole \ Http \ Request $ request ) { // echo "[websocket][onopen]server: handshake success with fd{$request->fd} url={$request->server['request_uri']}?{$request->server['query_string']}\n"; // Compat fpm server $ this -> _compatFPM ( $ request ) ; // print_r(self::$websocketFrameContext); // filter websocket router class // route struct: [$controller_name, $controller_class] $ controller_class = ( \ ePHP \ Core \ Route :: init ( ) ) -> findWebSocketRoute ( ) ; if ( ! empty ( $ controller_class ) ) { // Save websocket connection Context self :: $ websocketFrameContext [ $ request -> fd ] = [ 'get' => $ _GET , 'cookie' => $ _COOKIE , 'controller_class' => $ controller_class ] ; // echo 'pid='. getmypid() . ', fd=' . implode(',', array_keys(self::$websocketFrameContext)) //     . ', connections=' . count($this->server->connections) . "\n"; call_user_func ( [ new $ controller_class ( ) , 'onOpen' ] , $ server , $ request ) ; } }
WebSocket on open

@param Swoole\WebSocket\Server $server
@param \Swoole\Http\Request $request
@return void
WebSocket on open