Clients
Clients
Clients requests allow you to retrieve a list of clients connected at a point in time, and their details.
The request looks like this:
{
"clients": {
//array of streamnames to accumulate. Empty (or left out) means all.
"streams": ["streama", "streamb", "streamc"],
//array of protocols to accumulate. Empty (or left out) means all.
"protocols": ["HLS", "HSS"],
//list of requested data fields. Empty (or left out) means all.
"fields": ["host", "stream", "protocol", "conntime", "position", "down", "up", "downbps", "upbps"],
//unix timestamp of measuring moment. Negative means X seconds ago. Empty (or left out) means now.
"time": 1234567
}
}
//Or, when requesting multiple clients responses simultaneously:
{
"clients": [
{},//request object as above
{}//repeat the structure as many times as wanted
]
}
Since MistServer collects data continuously and requests might be segmented or sporadic, for most accurate results requestdata slightly in the past (e.g. 20-30 seconds in the past). The more current the data is, the higher the chance that data is incomplete.
The calls are responded to as follows:
{
"clients": {
//unix timestamp of data. Always present, always absolute.
"time": 1234567,
//array of actually represented data fields.
"fields": [...]
//for all clients, the data in the same order as the "fields" field.
"data": [[x, y, z], [x, y, z], [x, y, z]]
}
}
In case of the second method, the response is an array of responses like this, in the same order as the requests.
The fields represent:
-
host: IP address of connected user
-
stream: Stream name user is connected to
-
protocol: Protocol user is using to connect
-
conntime: Amount of seconds connection has been active
-
position: Current playback position in seconds user is at in the stream
-
down: Total bytes transferred down
-
up: Total bytes transferred up
-
downbps: Current bytes per second down
-
upbps: Current bytes per second up