Modifier and Type | Class and Description |
---|---|
class |
ClientChannelContext |
Modifier and Type | Field and Description |
---|---|
SetWithLock<ChannelContext> |
ClientTioConfig.closeds |
SetWithLock<ChannelContext> |
ClientTioConfig.connecteds |
Modifier and Type | Method and Description |
---|---|
LinkedBlockingQueue<ChannelContext> |
ReconnConf.getQueue() |
Modifier and Type | Method and Description |
---|---|
static ReconnConf |
ReconnConf.getReconnConf(ChannelContext channelContext) |
Modifier and Type | Method and Description |
---|---|
Packet |
ClientAioHandler.heartbeatPacket(ChannelContext channelContext)
创建心跳包
|
Modifier and Type | Field and Description |
---|---|
SetWithLock<ChannelContext> |
TioConfig.connections |
Modifier and Type | Method and Description |
---|---|
static ChannelContext |
Tio.getByBsId(TioConfig tioConfig,
String bsId)
根据业务id找ChannelContext
|
static ChannelContext |
Tio.getByChannelContextId(TioConfig tioConfig,
String channelContextId)
根据ChannelContext.id获取ChannelContext
|
static ChannelContext |
Tio.getByClientNode(TioConfig tioConfig,
String clientIp,
Integer clientPort)
根据clientip和clientport获取ChannelContext
|
static ChannelContext |
Tio.getChannelContextByBsId(TioConfig tioConfig,
String bsId)
Deprecated.
用getByBsId(TioConfig tioConfig, String bsId)
|
static ChannelContext |
Tio.getChannelContextByClientNode(TioConfig tioConfig,
String clientIp,
Integer clientPort)
Deprecated.
getByClientNode(tioConfig, clientIp, clientPort)
|
static ChannelContext |
Tio.getChannelContextById(TioConfig tioConfig,
String channelContextId)
Deprecated.
用getByChannelContextId(tioConfig, channelContextId)
|
Modifier and Type | Method and Description |
---|---|
static SetWithLock<ChannelContext> |
Tio.getAll(TioConfig tioConfig)
获取所有连接,包括当前处于断开状态的
|
static SetWithLock<ChannelContext> |
Tio.getAllChannelContexts(TioConfig tioConfig)
Deprecated.
用getAll(TioConfig tioConfig)
|
static SetWithLock<ChannelContext> |
Tio.getAllConnectedsChannelContexts(ClientTioConfig clientTioConfig)
Deprecated.
用getAllConnecteds(ClientTioConfig clientTioConfig)
|
static SetWithLock<ChannelContext> |
Tio.getByGroup(TioConfig tioConfig,
String group)
获取一个组的所有客户端
|
static SetWithLock<ChannelContext> |
Tio.getByIp(TioConfig tioConfig,
String ip)
根据客户端ip获取SetWithLock
|
static SetWithLock<ChannelContext> |
Tio.getByToken(TioConfig tioConfig,
String token)
根据token获取SetWithLock
|
static SetWithLock<ChannelContext> |
Tio.getByUserid(TioConfig tioConfig,
String userid)
根据userid获取SetWithLock
|
static SetWithLock<ChannelContext> |
Tio.getChannelContextsByGroup(TioConfig tioConfig,
String group)
Deprecated.
用getByGroup(tioConfig, group)
|
static SetWithLock<ChannelContext> |
Tio.getChannelContextsByToken(TioConfig tioConfig,
String token)
Deprecated.
用getByToken(tioConfig, token)
|
static SetWithLock<ChannelContext> |
Tio.getChannelContextsByUserid(TioConfig tioConfig,
String userid)
Deprecated.
用getByUserid(tioConfig, userid)
|
static SetWithLock<ChannelContext> |
Tio.getConnecteds(ClientTioConfig clientTioConfig)
此API仅供 tio client使用
获取所有处于正常连接状态的连接
|
static Page<ChannelContext> |
Tio.getPageOfAll(TioConfig tioConfig,
Integer pageIndex,
Integer pageSize) |
static Page<ChannelContext> |
Tio.getPageOfConnecteds(ClientTioConfig clientTioConfig,
Integer pageIndex,
Integer pageSize)
这个方法是给客户器端用的
|
static Page<ChannelContext> |
Tio.getPageOfGroup(TioConfig tioConfig,
String group,
Integer pageIndex,
Integer pageSize) |
Modifier and Type | Method and Description |
---|---|
static void |
Tio.bindBsId(ChannelContext channelContext,
String bsId)
绑定业务id
|
static void |
Tio.bindGroup(ChannelContext channelContext,
String group)
绑定群组
|
static void |
Tio.bindToken(ChannelContext channelContext,
String token)
绑定token
|
static void |
Tio.bindUser(ChannelContext channelContext,
String userid)
绑定用户
|
static Boolean |
Tio.bSend(ChannelContext channelContext,
Packet packet)
阻塞发送消息到指定ChannelContext
|
static void |
Tio.close(ChannelContext channelContext,
String remark)
关闭连接
|
static void |
Tio.close(ChannelContext channelContext,
String remark,
ChannelContext.CloseCode closeCode) |
static void |
Tio.close(ChannelContext channelContext,
Throwable throwable,
String remark)
关闭连接
|
static void |
Tio.close(ChannelContext channelContext,
Throwable throwable,
String remark,
boolean isNeedRemove) |
static void |
Tio.close(ChannelContext channelContext,
Throwable throwable,
String remark,
boolean isNeedRemove,
boolean needCloseLock) |
static void |
Tio.close(ChannelContext channelContext,
Throwable throwable,
String remark,
boolean isNeedRemove,
boolean needCloseLock,
ChannelContext.CloseCode closeCode) |
static void |
Tio.close(ChannelContext channelContext,
Throwable throwable,
String remark,
boolean isNeedRemove,
ChannelContext.CloseCode closeCode) |
static void |
Tio.close(ChannelContext channelContext,
Throwable throwable,
String remark,
ChannelContext.CloseCode closeCode) |
Packet |
PacketConverter.convert(Packet packet,
ChannelContext channelContext) |
boolean |
ChannelContextFilter.filter(ChannelContext channelContext)
过滤ChannelContext
|
static boolean |
Tio.isInGroup(String group,
ChannelContext channelContext)
某通道是否在某群组中
|
void |
DefaultAioListener.onAfterConnected(ChannelContext channelContext,
boolean isConnected,
boolean isReconnect) |
void |
DefaultAioListener.onAfterDecoded(ChannelContext channelContext,
Packet packet,
int packetSize) |
void |
DefaultAioListener.onAfterHandled(ChannelContext channelContext,
Packet packet,
long cost) |
void |
DefaultAioListener.onAfterReceivedBytes(ChannelContext channelContext,
int receivedBytes) |
void |
DefaultAioListener.onAfterSent(ChannelContext channelContext,
Packet packet,
boolean isSentSuccess) |
void |
DefaultAioListener.onBeforeClose(ChannelContext channelContext,
Throwable throwable,
String remark,
boolean isRemove) |
boolean |
DefaultAioListener.onHeartbeatTimeout(ChannelContext channelContext,
Long interval,
int heartbeatTimeoutCount) |
static void |
Tio.remove(ChannelContext channelContext,
String remark) |
static void |
Tio.remove(ChannelContext channelContext,
String remark,
ChannelContext.CloseCode closeCode)
和close方法对应,只不过不再进行重连等维护性的操作
|
static void |
Tio.remove(ChannelContext channelContext,
Throwable throwable,
String remark)
和close方法对应,只不过不再进行重连等维护性的操作
|
static void |
Tio.remove(ChannelContext channelContext,
Throwable throwable,
String remark,
ChannelContext.CloseCode closeCode)
和close方法对应,只不过不再进行重连等维护性的操作
|
static Boolean |
Tio.send(ChannelContext channelContext,
Packet packet)
发送消息到指定ChannelContext
|
static void |
Tio.unbindBsId(ChannelContext channelContext)
解绑业务id
|
static void |
Tio.unbindGroup(ChannelContext channelContext)
与所有组解除解绑关系
|
static void |
Tio.unbindGroup(String group,
ChannelContext channelContext)
与指定组解除绑定关系
|
static void |
Tio.unbindToken(ChannelContext channelContext)
解除channelContext绑定的token
|
static void |
Tio.unbindUser(ChannelContext channelContext)
解除channelContext绑定的userid
|
Modifier and Type | Method and Description |
---|---|
static Boolean |
Tio.bSendToSet(TioConfig tioConfig,
SetWithLock<ChannelContext> setWithLock,
Packet packet,
ChannelContextFilter channelContextFilter)
发消息到指定集合
|
static void |
Tio.closeSet(TioConfig tioConfig,
SetWithLock<ChannelContext> setWithLock,
String remark,
ChannelContext.CloseCode closeCode)
关闭集合
|
static void |
Tio.removeSet(TioConfig tioConfig,
SetWithLock<ChannelContext> setWithLock,
String remark,
ChannelContext.CloseCode closeCode)
移除集合
|
static void |
Tio.sendToSet(TioConfig tioConfig,
SetWithLock<ChannelContext> setWithLock,
Packet packet,
ChannelContextFilter channelContextFilter)
发消息到指定集合
|
Constructor and Description |
---|
ReadCompletionHandler(ChannelContext channelContext) |
WriteCompletionHandler(ChannelContext channelContext) |
Modifier and Type | Method and Description |
---|---|
Packet |
AioHandler.decode(ByteBuffer buffer,
int limit,
int position,
int readableLength,
ChannelContext channelContext)
根据ByteBuffer解码成业务需要的Packet对象.
|
ByteBuffer |
AioHandler.encode(Packet packet,
TioConfig tioConfig,
ChannelContext channelContext)
编码
|
void |
AioHandler.handler(Packet packet,
ChannelContext channelContext)
处理消息包
|
void |
GroupListener.onAfterBind(ChannelContext channelContext,
String group)
绑定群组后回调该方法
|
void |
AioListener.onAfterConnected(ChannelContext channelContext,
boolean isConnected,
boolean isReconnect)
建链后触发本方法,注:建链不一定成功,需要关注参数isConnected
|
void |
AioListener.onAfterDecoded(ChannelContext channelContext,
Packet packet,
int packetSize)
原方法名:onAfterDecoded
解码成功后触发本方法
|
void |
AioListener.onAfterHandled(ChannelContext channelContext,
Packet packet,
long cost)
处理一个消息包后
|
void |
AioListener.onAfterReceivedBytes(ChannelContext channelContext,
int receivedBytes)
接收到TCP层传过来的数据后
|
void |
PacketListener.onAfterSent(ChannelContext channelContext,
Packet packet,
boolean isSentSuccess) |
void |
AioListener.onAfterSent(ChannelContext channelContext,
Packet packet,
boolean isSentSuccess)
消息包发送之后触发本方法
|
void |
GroupListener.onAfterUnbind(ChannelContext channelContext,
String group)
解绑群组后回调该方法
|
void |
AioListener.onBeforeClose(ChannelContext channelContext,
Throwable throwable,
String remark,
boolean isRemove)
连接关闭前触发本方法
|
Modifier and Type | Method and Description |
---|---|
ChannelContext |
ClientNodes.find(String key) |
ChannelContext |
ClientNodes.find(String ip,
int port) |
ChannelContext |
BsIds.find(TioConfig tioConfig,
String bsId) |
ChannelContext |
Ids.find(TioConfig tioConfig,
String id)
Find.
|
Modifier and Type | Method and Description |
---|---|
IpStat |
IpStats._get(Long duration,
ChannelContext channelContext,
boolean forceCreate,
boolean useProxyClient) |
void |
Ips.bind(ChannelContext channelContext)
和ip绑定
|
void |
Ids.bind(ChannelContext channelContext) |
void |
BsIds.bind(ChannelContext channelContext,
String bsId) |
void |
Users.bind(String userid,
ChannelContext channelContext)
绑定userid.
|
void |
Tokens.bind(String token,
ChannelContext channelContext)
绑定token.
|
void |
Groups.bind(String groupid,
ChannelContext channelContext)
和组绑定
|
void |
Groups.bind(String groupid,
ChannelContext channelContext,
boolean callbackListener)
和组绑定
|
static void |
MaintainUtils.close(ChannelContext channelContext) |
static void |
MaintainUtils.deleteTempDir(ChannelContext channelContext) |
IpStat |
IpStats.get(Long duration,
ChannelContext channelContext)
根据ip获取IpStat,如果缓存中不存在,则创建
|
IpStat |
IpStats.get(Long duration,
ChannelContext channelContext,
boolean forceCreate)
根据ip获取IpStat,如果缓存中不存在,则根据forceCreate的值决定是否创建
|
static String |
ClientNodes.getKey(ChannelContext channelContext) |
SetWithLock<String> |
Groups.groups(ChannelContext channelContext)
某个客户端在哪些组中
|
void |
ClientNodes.put(ChannelContext channelContext)
添加映射
|
void |
ClientNodes.remove(ChannelContext channelContext)
Removes映射
|
static void |
MaintainUtils.remove(ChannelContext channelContext)
彻底删除,不再维护
|
static File |
MaintainUtils.tempDir(ChannelContext channelContext,
boolean forceCreate) |
static File |
MaintainUtils.tempReceivedFile(ChannelContext channelContext) |
static File |
MaintainUtils.tempWriteFile(ChannelContext channelContext) |
void |
BsIds.unbind(ChannelContext channelContext) |
void |
Users.unbind(ChannelContext channelContext)
解除channelContext绑定的userid
|
void |
Tokens.unbind(ChannelContext channelContext)
解除channelContext绑定的token
|
void |
Groups.unbind(ChannelContext channelContext)
与所有组解除绑定
|
void |
Ips.unbind(ChannelContext channelContext)
与指定ip解除绑定
|
void |
Ids.unbind(ChannelContext channelContext) |
void |
Groups.unbind(ChannelContext channelContext,
boolean callbackListener) |
void |
Groups.unbind(String groupid,
ChannelContext channelContext)
与指定组解除绑定
|
void |
Groups.unbind(String groupid,
ChannelContext channelContext,
boolean deleteFromChannelContext)
与指定组解除绑定
|
void |
Groups.unbind(String groupid,
ChannelContext channelContext,
boolean deleteFromChannelContext,
boolean callbackListener) |
Modifier and Type | Method and Description |
---|---|
static Set<ChannelContext> |
MaintainUtils.createSet(Comparator<ChannelContext> comparator) |
void |
Groups.setChannelContextComparator(Comparator<ChannelContext> channelContextComparator) |
Modifier and Type | Method and Description |
---|---|
ChannelContext |
SslFacadeContext.getChannelContext() |
Constructor and Description |
---|
SslFacadeContext(ChannelContext channelContext) |
SslHandshakeCompletedListener(ChannelContext channelContext) |
SslListener(ChannelContext channelContext) |
SslSessionClosedListener(ChannelContext channelContext) |
Constructor and Description |
---|
SSLFacade(ChannelContext channelContext,
SSLContext context,
boolean client,
boolean clientAuthRequired,
ITaskHandler taskHandler) |
Modifier and Type | Method and Description |
---|---|
void |
IpStatListener.onAfterConnected(ChannelContext channelContext,
boolean isConnected,
boolean isReconnect,
IpStat ipStat)
建链后触发本方法,注:建链不一定成功,需要关注参数isConnected
|
void |
DefaultIpStatListener.onAfterConnected(ChannelContext channelContext,
boolean isConnected,
boolean isReconnect,
IpStat ipStat) |
void |
IpStatListener.onAfterDecoded(ChannelContext channelContext,
Packet packet,
int packetSize,
IpStat ipStat)
解码成功后
|
void |
DefaultIpStatListener.onAfterDecoded(ChannelContext channelContext,
Packet packet,
int packetSize,
IpStat ipStat) |
void |
IpStatListener.onAfterHandled(ChannelContext channelContext,
Packet packet,
IpStat ipStat,
long cost)
处理一个消息包后
|
void |
DefaultIpStatListener.onAfterHandled(ChannelContext channelContext,
Packet packet,
IpStat ipStat,
long cost) |
void |
IpStatListener.onAfterReceivedBytes(ChannelContext channelContext,
int receivedBytes,
IpStat ipStat)
接收到一些字节数据后
|
void |
DefaultIpStatListener.onAfterReceivedBytes(ChannelContext channelContext,
int receivedBytes,
IpStat ipStat) |
void |
IpStatListener.onAfterSent(ChannelContext channelContext,
Packet packet,
boolean isSentSuccess,
IpStat ipStat)
发送后(注:不一定会发送成功)
|
void |
DefaultIpStatListener.onAfterSent(ChannelContext channelContext,
Packet packet,
boolean isSentSuccess,
IpStat ipStat) |
void |
IpStatListener.onDecodeError(ChannelContext channelContext,
IpStat ipStat)
解码异常时
|
void |
DefaultIpStatListener.onDecodeError(ChannelContext channelContext,
IpStat ipStat) |
Modifier and Type | Method and Description |
---|---|
FullWaitQueue<ChannelContext> |
CloseRunnable.getMsgQueue() |
Constructor and Description |
---|
DecodeRunnable(ChannelContext channelContext,
Executor executor) |
HandlerRunnable(ChannelContext channelContext,
Executor executor) |
SendRunnable(ChannelContext channelContext,
Executor executor) |
Modifier and Type | Method and Description |
---|---|
static boolean |
TioUtils.checkBeforeIO(ChannelContext channelContext) |
Modifier and Type | Method and Description |
---|---|
FlashPolicyPacket |
FlashPolicyServerAioHandler.decode(ByteBuffer buffer,
int limit,
int position,
int readableLength,
ChannelContext channelContext)
|
ByteBuffer |
FlashPolicyServerAioHandler.encode(Packet packet,
TioConfig tioConfig,
ChannelContext channelContext) |
void |
FlashPolicyServerAioHandler.handler(Packet packet,
ChannelContext channelContext)
处理消息
|
Modifier and Type | Field and Description |
---|---|
ChannelContext |
HttpRequest.channelContext |
Modifier and Type | Method and Description |
---|---|
ChannelContext |
HttpRequest.getChannelContext() |
Modifier and Type | Method and Description |
---|---|
static HttpRequest |
HttpRequestDecoder.decode(ByteBuffer buffer,
int limit,
int position,
int readableLength,
ChannelContext channelContext,
HttpConfig httpConfig) |
static void |
HttpMultiBodyDecoder.decode(HttpRequest request,
RequestLine firstLine,
byte[] bodyBytes,
String initboundary,
ChannelContext channelContext,
HttpConfig httpConfig) |
static void |
HttpRequestDecoder.decodeParams(Map<String,Object[]> params,
String queryString,
String charset,
ChannelContext channelContext) |
static ByteBuffer |
HttpResponseEncoder.encode(HttpResponse httpResponse,
TioConfig tioConfig,
ChannelContext channelContext) |
static HttpMultiBodyDecoder.Step |
HttpMultiBodyDecoder.parseBody(HttpMultiBodyDecoder.Header header,
HttpRequest request,
ByteBuffer buffer,
String boundary,
String endBoundary,
ChannelContext channelContext,
HttpConfig httpConfig) |
static void |
HttpMultiBodyDecoder.parseHeader(List<String> lines,
HttpMultiBodyDecoder.Header header,
ChannelContext channelContext)
【
Content-Disposition: form-data; name="uploadFile"; filename=""
Content-Type: application/octet-stream
】
【
Content-Disposition: form-data; name="end"
】
|
static RequestLine |
HttpRequestDecoder.parseRequestLine(ByteBuffer buffer,
ChannelContext channelContext)
parse request line(the first line)
|
void |
HttpRequest.setChannelContext(ChannelContext channelContext) |
Modifier and Type | Method and Description |
---|---|
static String |
IpUtils.getRealIp(ChannelContext channelContext,
HttpConfig httpConfig,
Map<String,String> httpHeaders)
获取真实ip
|
Modifier and Type | Method and Description |
---|---|
HttpRequest |
HttpServerAioHandler.decode(ByteBuffer buffer,
int limit,
int position,
int readableLength,
ChannelContext channelContext) |
ByteBuffer |
HttpServerAioHandler.encode(Packet packet,
TioConfig tioConfig,
ChannelContext channelContext) |
void |
HttpServerAioHandler.handler(Packet packet,
ChannelContext channelContext) |
void |
HttpServerAioListener.onAfterConnected(ChannelContext channelContext,
boolean isConnected,
boolean isReconnect) |
void |
HttpServerAioListener.onAfterDecoded(ChannelContext channelContext,
Packet packet,
int packetSize) |
void |
HttpServerAioListener.onAfterHandled(ChannelContext channelContext,
Packet packet,
long cost) |
void |
HttpServerAioListener.onAfterReceivedBytes(ChannelContext channelContext,
int receivedBytes) |
void |
HttpServerAioListener.onAfterSent(ChannelContext channelContext,
Packet packet,
boolean isSentSuccess) |
void |
HttpServerAioListener.onBeforeClose(ChannelContext channelContext,
Throwable throwable,
String remark,
boolean isRemove) |
boolean |
HttpServerAioListener.onHeartbeatTimeout(ChannelContext channelContext,
Long interval,
int heartbeatTimeoutCount) |
Modifier and Type | Class and Description |
---|---|
class |
ServerChannelContext |
Modifier and Type | Method and Description |
---|---|
boolean |
ServerAioListener.onHeartbeatTimeout(ChannelContext channelContext,
Long interval,
int heartbeatTimeoutCount)
服务器检查到心跳超时时,会调用这个函数(一般场景,该方法只需要直接返回false即可)
|
Modifier and Type | Method and Description |
---|---|
Packet |
WsClientAioHander.decode(ByteBuffer buffer,
int limit,
int position,
int readableLength,
ChannelContext ctx) |
ByteBuffer |
WsClientAioHander.encode(Packet packet,
TioConfig tioConfig,
ChannelContext ctx) |
void |
WsClientAioHander.handler(Packet packet,
ChannelContext ctx) |
Packet |
WsClientAioHander.heartbeatPacket(ChannelContext ctx) |
void |
WsClientAioListener.onAfterConnected(ChannelContext channelContext,
boolean isConnected,
boolean isReconnect) |
void |
WsClientAioListener.onAfterDecoded(ChannelContext channelContext,
Packet packet,
int packetSize) |
void |
WsClientAioListener.onAfterHandled(ChannelContext channelContext,
Packet packet,
long cost) |
void |
WsClientAioListener.onAfterReceivedBytes(ChannelContext channelContext,
int receivedBytes) |
void |
WsClientAioListener.onAfterSent(ChannelContext channelContext,
Packet packet,
boolean isSentSuccess) |
void |
WsClientAioListener.onBeforeClose(ChannelContext channelContext,
Throwable throwable,
String remark,
boolean isRemove) |
Modifier and Type | Method and Description |
---|---|
static HttpResponse |
HttpResponseDecoder.decode(ByteBuffer buffer,
int limit,
int position,
int readableLength,
ChannelContext channelContext) |
static void |
HttpResponseDecoder.decodeParams(Map<String,Object[]> params,
String queryString,
String charset,
ChannelContext channelContext) |
static ByteBuffer |
HttpRequestEncoder.encode(HttpRequest httpRequest,
TioConfig tioConfig,
ChannelContext channelContext) |
static ResponseLine |
HttpResponseDecoder.parseResponseLine(ByteBuffer buffer,
ChannelContext channelContext)
parse response line(the first line)
|
Modifier and Type | Method and Description |
---|---|
static Boolean |
TioKit.bSend(ChannelContext channelContext,
Packet packet,
int timeout,
TimeUnit timeUnit) |
Modifier and Type | Method and Description |
---|---|
static WsResponse |
WsClientDecoder.decode(ByteBuffer buf,
ChannelContext channelContext) |
static WsRequest |
WsServerDecoder.decode(ByteBuffer buf,
ChannelContext channelContext) |
static ByteBuffer |
WsClientEncoder.encode(WsPacket packet,
TioConfig tioConfig,
ChannelContext channelContext) |
static ByteBuffer |
WsServerEncoder.encode(WsResponse wsResponse,
TioConfig tioConfig,
ChannelContext channelContext) |
Modifier and Type | Method and Description |
---|---|
WsRequest |
WsServerAioHandler.decode(ByteBuffer buffer,
int limit,
int position,
int readableLength,
ChannelContext channelContext) |
ByteBuffer |
WsServerAioHandler.encode(Packet packet,
TioConfig tioConfig,
ChannelContext channelContext) |
void |
WsServerAioHandler.handler(Packet packet,
ChannelContext channelContext) |
void |
WsServerAioListener.onAfterConnected(ChannelContext channelContext,
boolean isConnected,
boolean isReconnect) |
void |
WsServerAioListener.onAfterDecoded(ChannelContext channelContext,
Packet packet,
int packetSize) |
void |
WsServerAioListener.onAfterHandled(ChannelContext channelContext,
Packet packet,
long cost) |
void |
WsServerAioListener.onAfterReceivedBytes(ChannelContext channelContext,
int receivedBytes) |
void |
WsServerAioListener.onAfterSent(ChannelContext channelContext,
Packet packet,
boolean isSentSuccess) |
void |
WsServerAioListener.onBeforeClose(ChannelContext channelContext,
Throwable throwable,
String remark,
boolean isRemove) |
boolean |
WsServerAioListener.onHeartbeatTimeout(ChannelContext channelContext,
Long interval,
int heartbeatTimeoutCount) |
static HttpResponse |
WsServerAioHandler.updateWebSocketProtocol(HttpRequest request,
ChannelContext channelContext)
本方法改编自baseio: https://gitee.com/generallycloud/baseio
感谢开源作者的付出 |
Modifier and Type | Method and Description |
---|---|
HttpResponse |
IWsMsgHandler.handshake(HttpRequest httpRequest,
HttpResponse httpResponse,
ChannelContext channelContext)
对httpResponse参数进行补充并返回,如果返回null表示不想和对方建立连接,框架会断开连接,如果返回非null,框架会把这个对象发送给对方
注:请不要在这个方法中向对方发送任何消息,因为这个时候握手还没完成,发消息会导致协议交互失败。
对于大部分业务,该方法只需要一行代码:return httpResponse;
|
void |
IWsMsgHandler.onAfterHandshaked(HttpRequest httpRequest,
HttpResponse httpResponse,
ChannelContext channelContext)
握手成功后触发该方法
|
Object |
IWsMsgHandler.onBytes(WsRequest wsRequest,
byte[] bytes,
ChannelContext channelContext)
当收到Opcode.BINARY消息时,执行该方法。也就是说如何你的ws是基于BINARY传输的,就会走到这个方法
|
Object |
IWsMsgHandler.onClose(WsRequest wsRequest,
byte[] bytes,
ChannelContext channelContext)
当收到Opcode.CLOSE时,执行该方法,业务层在该方法中一般不需要写什么逻辑,空着就好
|
Object |
IWsMsgHandler.onText(WsRequest wsRequest,
String text,
ChannelContext channelContext)
当收到Opcode.TEXT消息时,执行该方法。也就是说如何你的ws是基于TEXT传输的,就会走到这个方法
|
Copyright © 2021. All rights reserved.