连接信息(Connections)
获取集群连接信息
API 定义:
GET api/v3/connections/
请求示例:
GET api/v3/connections/?_page=1&_limit=10000
返回数据:
{
"code": 0,
"data": [
{
"clean_start": true,
"client_id": "mosquitto_mqtt",
"conn_mod": "emqx_connection",
"connected_at": "2019-04-29 11:05:01",
"heap_size": 2586,
"ipaddress": "127.0.0.1",
"is_bridge": false,
"keepalive": 60,
"mailbox_len": 0,
"node": "emqx@127.0.0.1",
"peercert": "nossl",
"port": 64899,
"proto_name": "MQIsdp",
"proto_ver": 3,
"recv_cnt": 2,
"recv_msg": 0,
"recv_oct": 47,
"recv_pkt": 2,
"reductions": 3588,
"send_cnt": 2,
"send_msg": 0,
"send_oct": 9,
"send_pend": 0,
"send_pkt": 2,
"username": "undefined",
"zone": "external"
}
],
"meta": {
"page": 1,
"limit": 10000,
"count": 1
}
}
获取节点连接信息
API 定义:
GET api/v3/nodes/${node}/connections/
请求示例:
GET api/v3/nodes/emqx@127.0.0.1/connections/?_page=1&_limit=10000
返回数据:
{
"code": 0,
"data": [
{
"clean_start": true,
"client_id": "mosquitto_mqtt",
"conn_mod": "emqx_connection",
"connected_at": "2019-04-29 11:05:01",
"heap_size": 610,
"ipaddress": "127.0.0.1",
"is_bridge": false,
"keepalive": 60,
"mailbox_len": 0,
"node": "emqx@127.0.0.1",
"peercert": "nossl",
"port": 64899,
"proto_name": "MQIsdp",
"proto_ver": 3,
"recv_cnt": 5,
"recv_msg": 0,
"recv_oct": 53,
"recv_pkt": 5,
"reductions": 6081,
"send_cnt": 5,
"send_msg": 0,
"send_oct": 15,
"send_pend": 0,
"send_pkt": 5,
"username": "undefined",
"zone": "external"
}
],
"meta": {
"page": 1,
"limit": 10000,
"count": 1
}
}
获取集群指定连接信息
API 定义:
GET api/v3/connections/${clientid}
请求示例:
GET api/v3/connections/mosquitto_mqtt
返回数据:
{
"code": 0,
"data": [
{
"clean_start": true,
"client_id": "mosquitto_mqtt",
"conn_mod": "emqx_connection",
"connected_at": "2019-04-29 11:05:01",
"heap_size": 610,
"ipaddress": "127.0.0.1",
"is_bridge": false,
"keepalive": 60,
"mailbox_len": 0,
"node": "emqx@127.0.0.1",
"peercert": "nossl",
"port": 64899,
"proto_name": "MQIsdp",
"proto_ver": 3,
"recv_cnt": 8,
"recv_msg": 0,
"recv_oct": 59,
"recv_pkt": 8,
"reductions": 8560,
"send_cnt": 8,
"send_msg": 0,
"send_oct": 21,
"send_pend": 0,
"send_pkt": 8,
"username": "undefined",
"zone": "external"
}
]
}
获取节点指定连接信息
API 定义:
GET api/v3/nodes/${node}/connections/${clientid}
请求示例:
GET api/v3/nodes/emqx@127.0.0.1/connections/mosquitto_mqtt
返回数据:
{
"code": 0,
"data": [
{
"clean_start": true,
"client_id": "mosquitto_mqtt",
"conn_mod": "emqx_connection",
"connected_at": "2019-04-29 11:05:01",
"heap_size": 610,
"ipaddress": "127.0.0.1",
"is_bridge": false,
"keepalive": 60,
"mailbox_len": 0,
"node": "emqx@127.0.0.1",
"peercert": "nossl",
"port": 64899,
"proto_name": "MQIsdp",
"proto_ver": 3,
"recv_cnt": 14,
"recv_msg": 0,
"recv_oct": 71,
"recv_pkt": 14,
"reductions": 13534,
"send_cnt": 14,
"send_msg": 0,
"send_oct": 33,
"send_pend": 0,
"send_pkt": 14,
"username": "undefined",
"zone": "external"
}
]
}
断开指定连接
API 定义:
DELETE api/v3/connections/${clientid}
请求示例:
DELETE api/v3/connections/mosquitto_mqtt
返回数据:
{
"code": 0
}