Session service
Session service provides showing pub/sub status to ThingScale's built-in message broker.
Both MQTT and WebSocket clients shown in session.
About how to see the session
If Publish from the device to the message broker is not a persistent session and disconnects the payload every time it is sent out, the session will be terminated in a very short period of time, so it is not possible to catch the session in most cases.
When a device subscribes to a message broker, it is inevitably a persistent session so it can be caught until the session ends.
List active session(s)
List active pub/sub clients.
Request Header:
| Header: | Description |
|---|---|
| X-APITOKEN | API_TOKEN_HERE |
Response Body:
| Elements | Type | Descritption |
|---|---|---|
| client_id | string | MQTT clientid |
| ipaddress | string | Client's IP address |
| clean_sess | boolean | MQTT clean session capability |
| proto_ver | number | MQTT protocol version |
| keepalive | number | MQTT keepalive timer |
| connected_at | string | pub/sub connection initiate time(ISO8601) |
GET https://m.thingscale.io/v2/session
Parameters: NONE
Sample payload:
[
{
"client_id": "mosqsub/14968-stg.testclient",
"ipaddress": "XXX.XXX.XXX.XXX",
"clean_sess": true,
"proto_ver": 3,
"keepalive": 60,
"connected_at": "2017-10-22T16:28:39+0900"
}
[
Sample curl
curl -X GET -H "X-APITOKEN: API_TOKEN_HERE" -k https://m.thingscale.io/v2/session
Response code:
| HTTP status: | Desc./Response body |
|---|---|
| 200 OK | Transaction OK. |
| 401 Unauthorized | {"error": "AUTH_REQUIRED"} |