public function onClose($server, $fd, $reactorId)
    {
        if (!$this->isServerWebsocket($fd) || !$server instanceof Server) {
            return;
        }

        /** @var Websocket $websocket */
        $websocket = $this->app->make(Websocket::class);

        try {
            $websocket->reset(true)->setSender($fd);
            // trigger 'disconnect' websocket event
            if ($websocket->eventExists('disconnect')) {
                $websocket->call('disconnect');
            } else {
                $this->websocketHandler->onClose($fd, $reactorId);
            }
            // leave all rooms
            $websocket->leave();
        } catch (Throwable $e) {
            $this->logServerError($e);
        }
    }
public function onClose($server, $fd, $reactorId)
    {
        if (!$this->isServerWebsocket($fd) || !$server instanceof Server) {
            return;
        }

        /** @var Websocket $websocket */
        $websocket = $this->app->make(Websocket::class);

        try {
            $websocket->reset(true)->setSender($fd);
            // trigger 'disconnect' websocket event
            if ($websocket->eventExists('disconnect')) {
                $websocket->call('disconnect');
            } else {
                $this->websocketHandler->onClose($fd, $reactorId);
            }
            // leave all rooms
            $websocket->leave();
        } catch (Throwable $e) {
            $this->logServerError($e);
        }
    }
public function onClose ( $ server , $ fd , $ reactorId ) { if ( ! $ this -> isServerWebsocket ( $ fd ) || ! $ server instanceof Server ) { return ; } /** @var Websocket $websocket */ $ websocket = $ this -> app -> make ( Websocket :: class ) ; try { $ websocket -> reset ( true ) -> setSender ( $ fd ) ; // trigger 'disconnect' websocket event if ( $ websocket -> eventExists ( 'disconnect' ) ) { $ websocket -> call ( 'disconnect' ) ; } else { $ this -> websocketHandler -> onClose ( $ fd , $ reactorId ) ; } // leave all rooms $ websocket -> leave ( ) ; } catch ( Throwable $ e ) { $ this -> logServerError ( $ e ) ; } }
"onClose" listener.

@param Server $server
@param int    $fd
@param int    $reactorId
onClose listener .