public class HeartBeat extends Object
Modifier and Type | Method and Description |
---|---|
static HeartBeat |
attachSession(IoSession session,
int connectModel)
将心跳绑定到 Session
默认使用 PING, PONG 作为心跳消息
|
static HeartBeat |
attachSession(IoSession session,
String ping,
String pong)
将心跳绑定到 Session
|
static boolean |
beat(IoSession session)
一次心跳动作
|
int |
getFailedCount()
获取连续失败次数
每次成功会被归零
|
byte[] |
getPing()
获取 ping 报文
|
byte[] |
getPong()
获取 pong 报文
|
static boolean |
interceptHeartBeat(IoSession session)
截断心跳消息
|
public byte[] getPing()
public byte[] getPong()
public int getFailedCount()
public static boolean interceptHeartBeat(IoSession session)
session
- 会话对象public static boolean beat(IoSession session)
session
- 会话对象public static HeartBeat attachSession(IoSession session, String ping, String pong)
session
- 会话ping
- ping 消息pong
- pong 消息Copyright © 2020 Voovan. All rights reserved.