Skip to content

websocket心跳保持

登录成功后,需要定时给服务上报心跳数据,建议30秒上报一次,此消息会收到服务器回复,收到任何服务器消息都认为服务正常,否则需要尝试断开重连

websocket 头字段

请求消息模式: 请求应答

请求消息类型: 1001

应答消息类型: 5001

推送消息定义

字段类型说明
hdrobject消息头,在登录中的表1:websocket消息头

示例

发送消息

json
{
    "hdr":{
        "message":"",
        "msgType":1001, //查看 消息类型定义
        "reqSN":1,
        "respSN":0  
    }
}
{
    "hdr":{
        "message":"",
        "msgType":1001, //查看 消息类型定义
        "reqSN":1,
        "respSN":0  
    }
}

响应消息

json
{
    "hdr":{
        "message":"",
        "msgType":5001, //查看 消息类型定义
        "reqSN":1,
        "respSN":1
    }
}
{
    "hdr":{
        "message":"",
        "msgType":5001, //查看 消息类型定义
        "reqSN":1,
        "respSN":1
    }
}