dispatch ws message
@param Server $server
@param Frame $frame
@throws \InvalidArgumentException
@throws \Swoft\WebSocket\Server\Exception\WsRouteException
@throws \Swoft\WebSocket\Server\Exception\ContextLostException
15662
public function message(Server $server, Frame $frame)
    {
        $fd = $frame->fd;

        try {
            if (!$path = WebSocketContext::getMeta('path', $fd)) {
                throw new ContextLostException("The connection info has lost of the fd#$fd, on message");
            }

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

            /** @var HandlerInterface $handler */
            $handler = \bean($className);
            $handler->onMessage($server, $frame);
        } catch (\Throwable $e) {
            /** @see \Swoft\Event\EventManager::hasListenerQueue() */
            if (App::hasBean('eventManager') && \bean('eventManager')->hasListenerQueue(WsEvent::ON_ERROR)) {
                App::trigger(WsEvent::ON_ERROR, $frame, $e);
            } else {
                App::error($e->getMessage(), ['fd' => $fd, 'data' => $frame->data]);
                // close connection
                $server->close($fd);
            }
        }
    }
1067409
public function process(IFrame $frame, IMessageHandler $handler)
    {
        // 路由解析
        $route = RequestContext::getServerBean('WSRoute');
        $result = $route->parse($frame->getFormatData());
        if(null === $result || !is_callable($result['callable']))
        {
            // 未找到匹配的命令，TODO:处理
            
        }
        else
        {
            RequestContext::set('routeResult', $result);

            $middlewares = $result['middlewares'];
            $middlewares[] = ActionMiddleware::class;
            $handler = new MessageHandler($middlewares);
            return $handler->handle($frame);
        }
        return $handler->handle($frame);
    }
699072
public void sendRequestToWc(FramePPHeaders frame) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "H2StreamProcessor.sendRequestToWc()");
        }

        if (null == frame) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "H2StreamProcessor.sendRequestToWc(): Frame is null");
            }
        } else {
            // Make the headers frame look like it just came in
            WsByteBuffer buf = frame.buildFrameForWrite();
            TCPReadRequestContext readi = h2HttpInboundLinkWrap.getConnectionContext().getReadInterface();
            readi.setBuffer(buf);

            // Call the synchronized method to handle the frame
            try {
                processNextFrame(frame, Constants.Direction.READ_IN);
            } catch (Http2Exception he) {
                // ProcessNextFrame() sends a reset/goaway if an error occurs, nothing left but to clean up
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "H2StreamProcessor.sendRequestToWc(): ProcessNextFrame() error, Exception: " + he);
                }

                // Free the buffer
                buf.release();
            }

        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "H2StreamProcessor.sendRequestToWc()");
        }

    }
159339
public function onMessage(WebSocketTransportInterface $user, WebSocketMessageInterface $msg) {
        $this->logger->notice("Broadcasting " . strlen($msg->getData()) . " bytes");

        foreach($this->getConnections() as $client){
            $client->sendString("User {$user->getId()} said: ".$msg->getData());
        }
    }
595461
private void dispatchServerChannelDeleteEvent(ServerChannel channel) {
        ServerChannelDeleteEvent event = new ServerChannelDeleteEventImpl(channel);

        api.getEventDispatcher().dispatchServerChannelDeleteEvent(
                (DispatchQueueSelector) channel.getServer(), channel.getServer(), channel, event);
    }
75479
public static void echoFrame(final WebSocketChannel channel, final StreamSourceFrameChannel ws) throws IOException {

        final WebSocketFrameType type;
        switch (ws.getType()) {
            case PONG:
                // pong frames must be discarded
                ws.close();
                return;
            case PING:
                // if a ping is send the autobahn testsuite expects a PONG when echo back
                type = WebSocketFrameType.PONG;
                break;
            default:
                type = ws.getType();
                break;
        }
        final StreamSinkFrameChannel sink = channel.send(type);
        sink.setRsv(ws.getRsv());
        initiateTransfer(ws, sink, new ChannelListener<StreamSourceFrameChannel>() {
                    @Override
                    public void handleEvent(StreamSourceFrameChannel streamSourceFrameChannel) {
                        IoUtils.safeClose(streamSourceFrameChannel);
                    }
                }, new ChannelListener<StreamSinkFrameChannel>() {
                    @Override
                    public void handleEvent(StreamSinkFrameChannel streamSinkFrameChannel) {
                        try {
                            streamSinkFrameChannel.shutdownWrites();
                        } catch (IOException e) {
                            UndertowLogger.REQUEST_IO_LOGGER.ioException(e);
                            IoUtils.safeClose(streamSinkFrameChannel, channel);
                            return;
                        }
                        try {
                            if (!streamSinkFrameChannel.flush()) {
                                streamSinkFrameChannel.getWriteSetter().set(ChannelListeners.flushingChannelListener(
                                        new ChannelListener<StreamSinkFrameChannel>() {
                                            @Override
                                            public void handleEvent(StreamSinkFrameChannel streamSinkFrameChannel) {
                                                streamSinkFrameChannel.getWriteSetter().set(null);
                                                IoUtils.safeClose(streamSinkFrameChannel);
                                                if (type == WebSocketFrameType.CLOSE) {
                                                    IoUtils.safeClose(channel);
                                                }
                                            }
                                        }, new ChannelExceptionHandler<StreamSinkFrameChannel>() {
                                            @Override
                                            public void handleException(StreamSinkFrameChannel streamSinkFrameChannel, IOException e) {

                                                UndertowLogger.REQUEST_IO_LOGGER.ioException(e);
                                                IoUtils.safeClose(streamSinkFrameChannel, channel);

                                            }
                                        }
                                ));
                                streamSinkFrameChannel.resumeWrites();
                            } else {
                                if (type == WebSocketFrameType.CLOSE) {
                                    IoUtils.safeClose(channel);
                                }
                                streamSinkFrameChannel.getWriteSetter().set(null);
                                IoUtils.safeClose(streamSinkFrameChannel);
                            }
                        } catch (IOException e) {
                            UndertowLogger.REQUEST_IO_LOGGER.ioException(e);
                            IoUtils.safeClose(streamSinkFrameChannel, channel);

                        }
                    }
                }, new ChannelExceptionHandler<StreamSourceFrameChannel>() {
                    @Override
                    public void handleException(StreamSourceFrameChannel streamSourceFrameChannel, IOException e) {
                        UndertowLogger.REQUEST_IO_LOGGER.ioException(e);
                        IoUtils.safeClose(streamSourceFrameChannel, channel);
                    }
                }, new ChannelExceptionHandler<StreamSinkFrameChannel>() {
                    @Override
                    public void handleException(StreamSinkFrameChannel streamSinkFrameChannel, IOException e) {
                        UndertowLogger.REQUEST_IO_LOGGER.ioException(e);
                        IoUtils.safeClose(streamSinkFrameChannel, channel);
                    }
                }, channel.getBufferPool()
        );

    }
1374677
protected function getCaller(Frame $frame)
    {
        $class = $frame->getClass();
        $fn = $frame->getFunction();
        $caller = '';

        if ($class) {
            $caller .= $class;
        }

        if ($class && $fn) {
            $caller .= '::';
        }

        if ($fn) {
            $caller .= $fn . '(' . $this->getArgumentsAsString($frame->getArgs()) . ')';
        }

        return $caller;
    }
1016871
public function serverStopProcess($msg = null)
  {
    TeamSpeak3_Helper_Signal::getInstance()->emit("notifyServershutdown", $this);

    $this->execute("serverprocessstop", array("reasonmsg" => $msg));
  }
1144639
public function message($msg)
    {
        foreach ($this as $client) {
            try {
                $this->execute(
                    "sendtextmessage",
                    array("msg" => $msg, "target" => $client, "targetmode" => Teamspeak::TEXTMSG_CLIENT)
                );
            } catch (TeamSpeak3_Adapter_ServerQuery_Exception $e) {
                /* ERROR_client_invalid_id */
                if ($e->getCode() != 0x0200) {
                    throw $e;
                }
            }
        }
    }
468734
protected function sendFrame($frame)
    {
        $c = &$this->attrs->get['c'];
        if (!is_string($c)) {
            $this->header('400 Bad Request');
            $this->finish();
            return;
        }
        $this->outputFrame($c . '(' . json_encode($frame, JSON_UNESCAPED_SLASHES) . ");\r\n");
        parent::sendFrame($frame);
    }
58678
public function onMessage(string $message, string $address, SocketInterface $socket)
    {
        try {
            $this->dispatch(Events::MESSAGE, new MessageEvent($socket, $address, $message));
            $socket->send($this->handleQueryFromStream($message), $address);
        } catch (\Exception $exception) {
            $this->dispatch(Events::SERVER_EXCEPTION, new ServerExceptionEvent($exception));
        }
    }
664920
public function receivedFrame(Frame $frame)
    {
        foreach ($this->observers as $item) {
            $item->receivedFrame($frame);
        }
    }
1372581
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);
        }

    }
499497
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]);
        }
    }
396228
public void onMessage(String sessionId, ByteBuffer buffer) {
        WebSocketSession session = WsonrpcRemotes.getSession(sessionId);
        byte[] bytes = buffer.array();
        WsonrpcSessions.begin(session);
        try {
            fireMessage(sessionId, bytes);
            wsonrpcControl.handle(session, bytes);
        } catch (Exception ex) {
            onError(session.getId(), ex);
        } finally {
            WsonrpcSessions.end();
        }
    }
1134183
public function beforeSend(Server $server)
    {

        // Build the server code
        $this->server_code = implode('', array_map('chr', explode('.', $server->ip()))) .
                             pack("S", $server->portClient());

        // Loop over the packets and update them
        foreach ($this->packets as $packetType => $packet) {
            // Fill out the packet with the server info
            $this->packets[$packetType] = sprintf($packet, $this->server_code);
        }
    }
1293308
public void message(String tag,
                        Object msg,
                        Frame frame)
    {
        long time = System.currentTimeMillis();
        message(tag,msg,frame,time);
    }