Notification API - list.active.tokens

This API action returns a list of active user tokens to which web notifications can be sent (currently connected users). Each returned token also has information on the number of currently open websockets (see the "clients" parameter in the response data).

API service and action

webntfWebsocket service called via API
list.active.tokensAction called on remote API

API request data

domainDomain name for select active user tokens

Example request data

array(3) {
    ["domain"]=>
    string(16) "www.websocket.cz"
}

Example PHP code for call websocket API

$responseData = $rest2WebSocket->call("webntf", "list.active.tokens", [
    "domain" => "www.websocket.cz"
]);

API response data

array(3) {
  ["status"]=>
  string(2) "OK"
  ["time"]=>
  float(1647533434.905635)
  ["result"]=>
  array(2) {
    [0]=>
    array(3) {
      ["key"]=>
      string(25) "6ju9xnrkhh7z163md12fkek3v"
      ["domain"]=>
      string(16) "www.websocket.cz"
      ["clients"]=>
      int(3)
    }
    [1]=>
    array(3) {
      ["key"]=>
      string(25) "nu9at76r5r7b213bgn8mhan8f"
      ["domain"]=>
      string(16) "www.websocket.cz"
      ["clients"]=>
      int(1)
    }
    [2]=>
    array(3) {
      ["key"]=>
      string(25) "w27m8767awa56r944w63t7maw"
      ["domain"]=>
      string(16) "www.websocket.cz"
      ["clients"]=>
      int(5)
    }
  }
}