public function close(Server $server, int $fd)
    {
        try {
            if (!$path = WebSocketContext::getMeta('path', $fd)) {
                throw new ContextLostException(
                    "The connection info has lost of the fd#$fd, on connection closed"
                );
            }

            $className = $this->getHandler($path)[0];

            /** @var HandlerInterface $handler */
            $handler = \bean($className);

            if (\method_exists($handler, 'onClose')) {
                $handler->onClose($server, $fd);
            }
        } catch (\Throwable $e) {
            App::error($e->getMessage(), ['fd' => $fd]);
        }
    }
public function close(Server $server, int $fd)
    {
        try {
            if (!$path = WebSocketContext::getMeta('path', $fd)) {
                throw new ContextLostException(
                    "The connection info has lost of the fd#$fd, on connection closed"
                );
            }

            $className = $this->getHandler($path)[0];

            /** @var HandlerInterface $handler */
            $handler = \bean($className);

            if (\method_exists($handler, 'onClose')) {
                $handler->onClose($server, $fd);
            }
        } catch (\Throwable $e) {
            App::error($e->getMessage(), ['fd' => $fd]);
        }
    }
public function close ( Server $ server , int $ fd ) { try { if ( ! $ path = WebSocketContext :: getMeta ( 'path' , $ fd ) ) { throw new ContextLostException ( "The connection info has lost of the fd#$fd, on connection closed" ) ; } $ className = $ this -> getHandler ( $ path ) [ 0 ] ; /** @var HandlerInterface $handler */ $ handler = \ bean ( $ className ) ; if ( \ method_exists ( $ handler , 'onClose' ) ) { $ handler -> onClose ( $ server , $ fd ) ; } } catch ( \ Throwable $ e ) { App :: error ( $ e -> getMessage ( ) , [ 'fd' => $ fd ] ) ; } }
dispatch ws close
@param Server $server
@param int $fd
@throws \InvalidArgumentException
@throws \Swoft\WebSocket\Server\Exception\WsRouteException
@throws \Swoft\WebSocket\Server\Exception\ContextLostException
dispatch ws close