会话(Sessions)
获取集群会话信息
API 定义:
GET api/v3/sessions/
请求示例:
GET api/v3/sessions/?_page=1&_limit=10000
返回数据:
{
"code": 0,
"data": [
{
"awaiting_rel_len": 0,
"binding": "local",
"clean_start": true,
"client_id": "mqttjs_f79fbc5a4b",
"created_at": "2019-04-29 11:28:04",
"deliver_msg": 0,
"enqueue_msg": 0,
"expiry_interval": 0,
"heap_size": 233,
"inflight_len": 0,
"mailbox_len": 0,
"max_awaiting_rel": 100,
"max_inflight": 32,
"max_mqueue": 1000,
"max_subscriptions": 0,
"mqueue_dropped": 0,
"mqueue_len": 0,
"node": "emqx@127.0.0.1",
"reductions": 211,
"subscriptions_count": 0,
"username": ""
},
{
"awaiting_rel_len": 0,
"binding": "local",
"clean_start": true,
"client_id": "mosquitto_mqtt",
"created_at": "2019-04-29 11:28:28",
"deliver_msg": 0,
"enqueue_msg": 0,
"expiry_interval": 0,
"heap_size": 376,
"inflight_len": 0,
"mailbox_len": 0,
"max_awaiting_rel": 100,
"max_inflight": 32,
"max_mqueue": 1000,
"max_subscriptions": 0,
"mqueue_dropped": 0,
"mqueue_len": 0,
"node": "emqx@127.0.0.1",
"reductions": 202,
"subscriptions_count": 0,
"username": "undefined"
}
],
"meta": {
"page": 1,
"limit": 10000,
"count": 2
}
}
获取集群指定会话信息
API 定义:
GET api/v3/sessions/${clientid}
请求示例:
GET api/v3/sessions/mosquitto_mqtt
返回数据:
{
"code": 0,
"data": [
{
"awaiting_rel_len": 0,
"binding": "local",
"clean_start": true,
"client_id": "mosquitto_mqtt",
"created_at": "2019-04-29 11:28:28",
"deliver_msg": 0,
"enqueue_msg": 0,
"expiry_interval": 0,
"heap_size": 376,
"inflight_len": 0,
"mailbox_len": 0,
"max_awaiting_rel": 100,
"max_inflight": 32,
"max_mqueue": 1000,
"max_subscriptions": 0,
"mqueue_dropped": 0,
"mqueue_len": 0,
"node": "emqx@127.0.0.1",
"reductions": 453,
"subscriptions_count": 1,
"username": "undefined"
}
]
}
获取节点会话信息
API 定义:
GET api/v3/nodes/${node}/sessions/
请求示例:
GET api/v3/nodes/emqx@127.0.0.1/sessions/?_page=1&_limit=10000
返回数据:
{
"code": 0,
"data": [
{
"awaiting_rel_len": 0,
"binding": "local",
"clean_start": true,
"client_id": "mqttjs_f79fbc5a4b",
"created_at": "2019-04-29 11:28:04",
"deliver_msg": 0,
"enqueue_msg": 0,
"expiry_interval": 0,
"heap_size": 233,
"inflight_len": 0,
"mailbox_len": 0,
"max_awaiting_rel": 100,
"max_inflight": 32,
"max_mqueue": 1000,
"max_subscriptions": 0,
"mqueue_dropped": 0,
"mqueue_len": 0,
"node": "emqx@127.0.0.1",
"reductions": 211,
"subscriptions_count": 0,
"username": ""
},
{
"awaiting_rel_len": 0,
"binding": "local",
"clean_start": true,
"client_id": "mosquitto_mqtt",
"created_at": "2019-04-29 11:28:28",
"deliver_msg": 0,
"enqueue_msg": 0,
"expiry_interval": 0,
"heap_size": 376,
"inflight_len": 0,
"mailbox_len": 0,
"max_awaiting_rel": 100,
"max_inflight": 32,
"max_mqueue": 1000,
"max_subscriptions": 0,
"mqueue_dropped": 0,
"mqueue_len": 0,
"node": "emqx@127.0.0.1",
"reductions": 453,
"subscriptions_count": 1,
"username": "undefined"
}
],
"meta": {
"page": 1,
"limit": 10000,
"count": 2
}
}
获取节点指定会话信息
API 定义:
GET api/v3/nodes/${node}/sessions/${clientid}
请求示例:
GET api/v3/nodes/emqx@127.0.0.1/sessions/mosquitto_mqtt
请求参数:
{
"topic": "test_topic",
"payload": "hello",
"qos": 1,
"retain": false,
"client_id": "mqttjs_ab9069449e"
}
返回数据:
{
"code": 0,
"data": [
{
"awaiting_rel_len": 0,
"binding": "local",
"clean_start": true,
"client_id": "mosquitto_mqtt",
"created_at": "2018-09-12 10:42:57",
"deliver_msg": 0,
"enqueue_msg": 0,
"expiry_interval": 7200,
"heap_size": 376,
"inflight_len": 0,
"mailbox_len": 0,
"max_awaiting_rel": 100,
"max_inflight": 32,
"max_mqueue": 1000,
"max_subscriptions": 0,
"mqueue_dropped": 0,
"mqueue_len": 0,
"node": "emqx@127.0.0.1",
"reductions": 203,
"subscriptions_count": 0,
"username": "mosquitto_mqtt"
}
]
}