Class MqttWsMsgHandler
- java.lang.Object
-
- br.com.anteros.mqtt.core.server.http.websocket.MqttWsMsgHandler
-
- All Implemented Interfaces:
org.tio.websocket.server.handler.IWsMsgHandler,org.tio.websocket.server.handler.IWsSubProtocolsMsgHandler
public class MqttWsMsgHandler extends Object implements org.tio.websocket.server.handler.IWsMsgHandler
mqtt websocket 消息处理- Author:
- L.cm
-
-
Constructor Summary
Constructors Constructor Description MqttWsMsgHandler(MqttServerCreator serverCreator, String[] supportedSubProtocols, org.tio.core.intf.AioHandler aioHandler)MqttWsMsgHandler(MqttServerCreator serverCreator, org.tio.core.intf.AioHandler aioHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.tio.websocket.common.WsResponseencodeSubProtocol(org.tio.core.intf.Packet packet, org.tio.core.TioConfig tioConfig, org.tio.core.ChannelContext context)String[]getSupportedSubProtocols()org.tio.http.common.HttpResponsehandshake(org.tio.http.common.HttpRequest request, org.tio.http.common.HttpResponse httpResponse, org.tio.core.ChannelContext channelContext)voidonAfterHandshaked(org.tio.http.common.HttpRequest request, org.tio.http.common.HttpResponse response, org.tio.core.ChannelContext context)握手后处理ObjectonBytes(org.tio.websocket.common.WsRequest wsRequest, byte[] bytes, org.tio.core.ChannelContext context)字节消息(binaryType = arraybuffer)过来后会走这个方法ObjectonClose(org.tio.websocket.common.WsRequest wsRequest, byte[] bytes, org.tio.core.ChannelContext context)当客户端发 close flag 时,会走这个方法ObjectonText(org.tio.websocket.common.WsRequest wsRequest, String text, org.tio.core.ChannelContext context)字符消息(binaryType = blob)过来后会走这个方法
-
-
-
Constructor Detail
-
MqttWsMsgHandler
public MqttWsMsgHandler(MqttServerCreator serverCreator, org.tio.core.intf.AioHandler aioHandler)
-
MqttWsMsgHandler
public MqttWsMsgHandler(MqttServerCreator serverCreator, String[] supportedSubProtocols, org.tio.core.intf.AioHandler aioHandler)
-
-
Method Detail
-
getSupportedSubProtocols
public String[] getSupportedSubProtocols()
- Specified by:
getSupportedSubProtocolsin interfaceorg.tio.websocket.server.handler.IWsSubProtocolsMsgHandler
-
handshake
public org.tio.http.common.HttpResponse handshake(org.tio.http.common.HttpRequest request, org.tio.http.common.HttpResponse httpResponse, org.tio.core.ChannelContext channelContext)- Specified by:
handshakein interfaceorg.tio.websocket.server.handler.IWsMsgHandler
-
onAfterHandshaked
public void onAfterHandshaked(org.tio.http.common.HttpRequest request, org.tio.http.common.HttpResponse response, org.tio.core.ChannelContext context)握手后处理- Specified by:
onAfterHandshakedin interfaceorg.tio.websocket.server.handler.IWsMsgHandler- Parameters:
request- HttpRequestresponse- HttpResponsecontext- ChannelContext
-
onBytes
public Object onBytes(org.tio.websocket.common.WsRequest wsRequest, byte[] bytes, org.tio.core.ChannelContext context) throws Exception
字节消息(binaryType = arraybuffer)过来后会走这个方法- Specified by:
onBytesin interfaceorg.tio.websocket.server.handler.IWsMsgHandler- Throws:
Exception
-
encodeSubProtocol
public org.tio.websocket.common.WsResponse encodeSubProtocol(org.tio.core.intf.Packet packet, org.tio.core.TioConfig tioConfig, org.tio.core.ChannelContext context)- Specified by:
encodeSubProtocolin interfaceorg.tio.websocket.server.handler.IWsSubProtocolsMsgHandler
-
onClose
public Object onClose(org.tio.websocket.common.WsRequest wsRequest, byte[] bytes, org.tio.core.ChannelContext context)
当客户端发 close flag 时,会走这个方法- Specified by:
onClosein interfaceorg.tio.websocket.server.handler.IWsMsgHandler
-
-