会话(Sessions)

获取集群会话信息

API 定义:

  1. GET api/v3/sessions/

请求示例:

  1. GET api/v3/sessions/?_page=1&_limit=10000

返回数据:

  1. {
  2. "code": 0,
  3. "data": [
  4. {
  5. "awaiting_rel_len": 0,
  6. "binding": "local",
  7. "clean_start": true,
  8. "client_id": "mqttjs_f79fbc5a4b",
  9. "created_at": "2019-04-29 11:28:04",
  10. "deliver_msg": 0,
  11. "enqueue_msg": 0,
  12. "expiry_interval": 0,
  13. "heap_size": 233,
  14. "inflight_len": 0,
  15. "mailbox_len": 0,
  16. "max_awaiting_rel": 100,
  17. "max_inflight": 32,
  18. "max_mqueue": 1000,
  19. "max_subscriptions": 0,
  20. "mqueue_dropped": 0,
  21. "mqueue_len": 0,
  22. "node": "emqx@127.0.0.1",
  23. "reductions": 211,
  24. "subscriptions_count": 0,
  25. "username": ""
  26. },
  27. {
  28. "awaiting_rel_len": 0,
  29. "binding": "local",
  30. "clean_start": true,
  31. "client_id": "mosquitto_mqtt",
  32. "created_at": "2019-04-29 11:28:28",
  33. "deliver_msg": 0,
  34. "enqueue_msg": 0,
  35. "expiry_interval": 0,
  36. "heap_size": 376,
  37. "inflight_len": 0,
  38. "mailbox_len": 0,
  39. "max_awaiting_rel": 100,
  40. "max_inflight": 32,
  41. "max_mqueue": 1000,
  42. "max_subscriptions": 0,
  43. "mqueue_dropped": 0,
  44. "mqueue_len": 0,
  45. "node": "emqx@127.0.0.1",
  46. "reductions": 202,
  47. "subscriptions_count": 0,
  48. "username": "undefined"
  49. }
  50. ],
  51. "meta": {
  52. "page": 1,
  53. "limit": 10000,
  54. "count": 2
  55. }
  56. }

获取集群指定会话信息

API 定义:

  1. GET api/v3/sessions/${clientid}

请求示例:

  1. GET api/v3/sessions/mosquitto_mqtt

返回数据:

  1. {
  2. "code": 0,
  3. "data": [
  4. {
  5. "awaiting_rel_len": 0,
  6. "binding": "local",
  7. "clean_start": true,
  8. "client_id": "mosquitto_mqtt",
  9. "created_at": "2019-04-29 11:28:28",
  10. "deliver_msg": 0,
  11. "enqueue_msg": 0,
  12. "expiry_interval": 0,
  13. "heap_size": 376,
  14. "inflight_len": 0,
  15. "mailbox_len": 0,
  16. "max_awaiting_rel": 100,
  17. "max_inflight": 32,
  18. "max_mqueue": 1000,
  19. "max_subscriptions": 0,
  20. "mqueue_dropped": 0,
  21. "mqueue_len": 0,
  22. "node": "emqx@127.0.0.1",
  23. "reductions": 453,
  24. "subscriptions_count": 1,
  25. "username": "undefined"
  26. }
  27. ]
  28. }

获取节点会话信息

API 定义:

  1. GET api/v3/nodes/${node}/sessions/

请求示例:

  1. GET api/v3/nodes/emqx@127.0.0.1/sessions/?_page=1&_limit=10000

返回数据:

  1. {
  2. "code": 0,
  3. "data": [
  4. {
  5. "awaiting_rel_len": 0,
  6. "binding": "local",
  7. "clean_start": true,
  8. "client_id": "mqttjs_f79fbc5a4b",
  9. "created_at": "2019-04-29 11:28:04",
  10. "deliver_msg": 0,
  11. "enqueue_msg": 0,
  12. "expiry_interval": 0,
  13. "heap_size": 233,
  14. "inflight_len": 0,
  15. "mailbox_len": 0,
  16. "max_awaiting_rel": 100,
  17. "max_inflight": 32,
  18. "max_mqueue": 1000,
  19. "max_subscriptions": 0,
  20. "mqueue_dropped": 0,
  21. "mqueue_len": 0,
  22. "node": "emqx@127.0.0.1",
  23. "reductions": 211,
  24. "subscriptions_count": 0,
  25. "username": ""
  26. },
  27. {
  28. "awaiting_rel_len": 0,
  29. "binding": "local",
  30. "clean_start": true,
  31. "client_id": "mosquitto_mqtt",
  32. "created_at": "2019-04-29 11:28:28",
  33. "deliver_msg": 0,
  34. "enqueue_msg": 0,
  35. "expiry_interval": 0,
  36. "heap_size": 376,
  37. "inflight_len": 0,
  38. "mailbox_len": 0,
  39. "max_awaiting_rel": 100,
  40. "max_inflight": 32,
  41. "max_mqueue": 1000,
  42. "max_subscriptions": 0,
  43. "mqueue_dropped": 0,
  44. "mqueue_len": 0,
  45. "node": "emqx@127.0.0.1",
  46. "reductions": 453,
  47. "subscriptions_count": 1,
  48. "username": "undefined"
  49. }
  50. ],
  51. "meta": {
  52. "page": 1,
  53. "limit": 10000,
  54. "count": 2
  55. }
  56. }

获取节点指定会话信息

API 定义:

  1. GET api/v3/nodes/${node}/sessions/${clientid}

请求示例:

  1. GET api/v3/nodes/emqx@127.0.0.1/sessions/mosquitto_mqtt

请求参数:

  1. {
  2. "topic": "test_topic",
  3. "payload": "hello",
  4. "qos": 1,
  5. "retain": false,
  6. "client_id": "mqttjs_ab9069449e"
  7. }

返回数据:

  1. {
  2. "code": 0,
  3. "data": [
  4. {
  5. "awaiting_rel_len": 0,
  6. "binding": "local",
  7. "clean_start": true,
  8. "client_id": "mosquitto_mqtt",
  9. "created_at": "2018-09-12 10:42:57",
  10. "deliver_msg": 0,
  11. "enqueue_msg": 0,
  12. "expiry_interval": 7200,
  13. "heap_size": 376,
  14. "inflight_len": 0,
  15. "mailbox_len": 0,
  16. "max_awaiting_rel": 100,
  17. "max_inflight": 32,
  18. "max_mqueue": 1000,
  19. "max_subscriptions": 0,
  20. "mqueue_dropped": 0,
  21. "mqueue_len": 0,
  22. "node": "emqx@127.0.0.1",
  23. "reductions": 203,
  24. "subscriptions_count": 0,
  25. "username": "mosquitto_mqtt"
  26. }
  27. ]
  28. }