Class MqttWebServerAioHandler

  • All Implemented Interfaces:
    org.tio.core.intf.AioHandler, org.tio.server.intf.ServerAioHandler

    public class MqttWebServerAioHandler
    extends Object
    implements org.tio.server.intf.ServerAioHandler
    websocket 和 http 共存
    Author:
    tanyaowu, L.cm
    • Constructor Summary

      Constructors 
      Constructor Description
      MqttWebServerAioHandler​(org.tio.http.common.HttpConfig httpConfig, org.tio.http.common.handler.HttpRequestHandler requestHandler, org.tio.websocket.server.handler.IWsMsgHandler wsMsgHandler)  
    • Constructor Detail

      • MqttWebServerAioHandler

        public MqttWebServerAioHandler​(org.tio.http.common.HttpConfig httpConfig,
                                       org.tio.http.common.handler.HttpRequestHandler requestHandler,
                                       org.tio.websocket.server.handler.IWsMsgHandler wsMsgHandler)
    • Method Detail

      • decode

        public org.tio.core.intf.Packet decode​(ByteBuffer buffer,
                                               int limit,
                                               int position,
                                               int readableLength,
                                               org.tio.core.ChannelContext context)
                                        throws org.tio.core.exception.TioDecodeException
        Specified by:
        decode in interface org.tio.core.intf.AioHandler
        Throws:
        org.tio.core.exception.TioDecodeException
      • encode

        public ByteBuffer encode​(org.tio.core.intf.Packet packet,
                                 org.tio.core.TioConfig tioConfig,
                                 org.tio.core.ChannelContext channelContext)
        Specified by:
        encode in interface org.tio.core.intf.AioHandler
      • handler

        public void handler​(org.tio.core.intf.Packet packet,
                            org.tio.core.ChannelContext channelContext)
                     throws Exception
        Specified by:
        handler in interface org.tio.core.intf.AioHandler
        Throws:
        Exception
      • updateWebSocketProtocol

        public org.tio.http.common.HttpResponse updateWebSocketProtocol​(org.tio.http.common.HttpRequest request)
                                                                 throws org.tio.core.exception.TioDecodeException
        本方法改编自baseio: https://gitee.com/generallycloud/baseio
        感谢开源作者的付出
        Parameters:
        request - HttpRequest
        Returns:
        HttpResponse
        Throws:
        org.tio.core.exception.TioDecodeException - TioDecodeException