onList()

wrtc.onList() is an event function called when lists are stored to or retrieved from the central IXNX server.

Lists are different types of data that a client might want to store at a secure, central location so it survives power off. The stored data is supposed to be as little as possible, a few KB at most. Or it might be a list that the IXNX server generated by itself, containing data clients might request.

Arguments

wrtc.onList(type, list, data, error)

  • type - string containing wrtc command type that caused the onList() event:
  • list - string containing name of list:
  • data - JSON structure containing the retrieved data, or description of occurred error, see below
  • error - if an error has occurred: error number describing the problem:
    • 404 - unknown list type (data will contain string "Not Found")
    • 405 - read-only list type (data will contain string "Not Allowed")

If no error argument error is empty.

data format

The format of the JSON structure returned in argument data depends on the list's name in argument list:

list: call_log

When reporting list of calls user has made or received the retrieved JSON structure in data has the following format:

{last_id:…, data:[{…},{…},…]}

There:

  • last_id - unique ID of last data entry, can be used for next wrtc.getList("call_log")
  • data - array containing elements there each element has the following values:
    • id - unique ID of the data entry
    • time - start time of call, in seconds since epoch
    • from - addressname of person initiating the call
    • to - addressname of person who was called
    • durtn - duration of call in seconds, or 0 if call was not answered

list: msg_log

When reporting list of chat messages user has sent or received the retrieved JSON structure in data has the following format:

{last_id:…, data:[{…},{…},…]}

There:

  • last_id - unique ID of last data entry, can be used for next wrtc.getList("msg_log")
  • data - array containing elements there each element has the following values:
    • id - unique ID of the data entry
    • time - time message was sent, in seconds since epoch
    • from - addressname of person sending the message
    • to - addressname of person receiving the message
    • text - string containing text content of the message

Return value

Ignored.

Example

To fetch the list of calls user has made call wrtc.getList("call_log").

It will trigger an answer:

wrtc.onList("get_list", "call_log", {last_id:85632, data:[{id:50372, time:1647016200,from:"adam",to:"david",durtn:23}, {id:85632, time:1647016300,from:"david",to:"peter",durtn:0}]})

Also See

ixnx/wrtc/js/api/wrtc/onlist.txt · Last modified: by tibor
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0