RPP WEBSOCKET MESSAGING
RTLS Server Streaming Data Format
The RPP Websocket API uses a publisher-subscriber mechanism to allow the HTTP client to receive streaming data from the server. Use the WebSocket Messaging API to:
- Get a list of available channels on the server.
- Subscribe to one or more channels.
- Unsubscribe from one or more channels.
- Receive streaming data from the server.
RPP WebSocket API uses the lightweight stateless remote procedure call (RPC) protocol JSON-RPC 2.0 to provide interfaces to manage subscriptions and receive streaming data. For more information, see the JSON-RPC 2.0 Specification.
A publisher (server) creates and sends broadcast messages to a channel. A subscriber (client) creates a subscription to a channel to receive messages broadcasted by the server.
Get websocket url
To get the WebSocket url, use the REST call:
GET api/wshost
which returns:
{
"wsHost": "servername.domainname.com/api/ws/"
}
RPP WebSocket Methods
The following table describes API methods and their parameters in JSON-RPC terminology.
| Method | Parameters | Caller | Description |
|---|---|---|---|
| get | entity:
|
Client | Get the list of the available channels on the server to subscribe. See Auth API for the GET parameters project_uid, userEmail, and authToken. |
| add | project_uid userEmail authToken entity:
|
Client | Subscribe to the list of channels. |
| delete | project_uid userEmail authToken entity:
|
Client | Unsubscribe from the list of channels. |
| notify | subscription:
|
Server | Receive the data stream pushed from the server to the client. |
Methods
All methods from client to server should have "id" as parameter as it can be used to track request response matching.
get
Use the get method to get the list of available channels.
Example request
{
"jsonrpc":"2.0",
"method":"get",
"params":{"entity":"channels"},
"id":15
}
Example response
{
"jsonrpc":"2.0",
"id":15,
"result":["pos","alarm","notify"]
}
List of available channels
| Channel | Description |
|---|---|
pos |
Position reports. |
notify |
An asynchronous notification channel for application events, such as creating and modifying objects, including, anchors, zones, and so on. |
alarm |
Alarms. |
add
Use the add method to subscribe to channels.
Example request
{
"jsonrpc":"2.0",
"method":"add",
"params":{
"data": ["pos","notify"],
"entity":"subscriptions",
"userEmail":"test@redpointpositioning.com",
"authToken":"y3jK0EU-TkKKIxBETwup",
"project_uid":"jVrlR-ZERcmq0urnJ41Jgg"
},
"id":19
}
Example response
{
"jsonrpc":"2.0",
"id":19,
"result":["pos","notify"]
}
delete
Use the delete method to unsubscribe from a channel.
Example request
{
"jsonrpc":"2.0",
"method":"delete",
"params":{
"data":["alarm"],
"entity":"subscriptions",
"userEmail":"test@redpointpositioning.com",
"authToken":"y3jK0EU-TkKKIxBETwup",
"project_uid":"jVrlR-ZERcmq0urnJ41Jgg"
},
"id":24
}
Example response
{
"jsonrpc":"2.0",
"id":24,
"result":["alarm"]
}
notify
Use the notify method to receive streaming data on one of the available channels.
When a message is delivered using WebSocket, the channel name is listed as the subscription parameter and the data included as the data parameter.
pos channel
The pos channel is used to deliver positions from nodes.
Position fields
| Name | Type | Values | Description |
|---|---|---|---|
| ts | int | - | The Unix epoch timestamp. |
| ms | int | - | The milliseconds part of the timestamp. |
| dev_id | string | - | The unique identifier of the reporting device. |
| id | int | - | The ID of the device. The field is announced deprecated. It will be available for 6 months minimum(until May 2022). Please, use mac instead. |
| mac | string | - | The MAC address of the device. |
| x | int | - | The X position of the device. |
| y | int | - | The Y position of the device. |
| z | int | - | The Z position of the device. |
| locationId | int | - | The identifier of the site in the context of the database. The field is announced deprecated. It will be available for 6 months minimum(until May 2022). |
| sl | int | - | The ID of the sublocation. The field is announced deprecated. It will be available for 6 months minimum(until May 2022). Please, use sl_id instead. |
| sl_id | string | - | The unique identifier of the sublocation. |
| fom | int | - | The figure of merit. Note that this option is not present in 0D. |
| er | int | - | 0D mode - distance to 0D anchor in millimeters 1D mode – distance to the line connecting anchor pair(millimeters) Note: Only available in 0D and 1D modes. The field is announced deprecated. It will be available for 6 months minimum(until May 2022). |
| type | string |
|
The type of reporting device. |
| to_type_id | int |
|
The identifier of reporting device type. The field is announced deprecated. It will be available for 6 months minimum(until May 2022). |
| sfsn | int | - | The sequence number for the device. The field is announced deprecated. It will be available for 6 months minimum(until May 2022). |
| slvr_mode | string |
|
The PE solver mode used to compute the position. The field is announced deprecated. It will be available for 6 months minimum(until May 2022). |
| pe_dim | int |
|
The PE mode in 2D or 3D. The field is announced deprecated. It will be available for 6 months minimum(until May 2022). |
| inactive | bool |
|
The flag that indicated the tag mode: false - tag is moving, true - tag is not moving. The field is announced deprecated. It will be available for 6 months minimum(until May 2022). |
| edge_corr | bool | - | Indicates that an edge correction was applied. The field is announced deprecated. It will be available for 6 months minimum(until May 2022). |
| project_uid | String(22) | - | The unique identifier for the project. |
| company_uid | String(22) | - | The unique identifier for the company. |
Position message example
{
"jsonrpc":"2.0",
"method":"notify",
"params":{
"subscription":"pos",
"data":
{
"ts":1510687065,
"ms":980,
"id":null,
"dev_id":"KCHEhmDkSlG0pLJpAlgDxw",
"mac":"e4956ea50a8c",
"x":3504,
"y":224,
"z":1008,
"locationId":null,
"sl":null,
"sl_id":"vFmP3l2hQOKwdqLcf4gfJg",
"fom":50,
"to_type_id":null,
"sfsn":157,
"slvr_mode":"TDOA",
"inactive":false,
"edge_corr":false,
"pe_dim":2,
"type":"UWB",
"project_uid":"jVrlR-ZERcmq0urnJ41Jgg",
"company_uid":"9RbFAAOwSc2hPvKyqDrkEA"
}
}
}
notify channel
The notify channel is used to deliver asynchronous notifications about changes applied to the application objects, including zones, anchors, schedules, and so on.
Notify fields
| Field | Type | Values | Description |
|---|---|---|---|
| ts | Number | - | The seconds part of the timestamp. |
| ms | Number | - | The milliseconds part of the timestamp. |
| object | String | Object type | The object type, which depends on the API route that was called. |
| action | String | Action type | The action type which depends on which action called the object. |
| plist | Object | Plist content | The result of the action. See the response of route 'object' and action 'action'. |
| project_uid | String(22) | - | Project unique ID |
| created_by.uid | String(22) | - | The unique identifier of the user that created the action. |
| created_by.email | String | - | The email address of the user that created the action. |
Action type
| Value | Description |
|---|---|
| created | Notification action from API POST. |
| updated | Notification action from API PUT. |
| assign | Notification action from NODES API PUT. |
| release | Notification action from NODES API PUT. |
| deleted | Notification action from API DELETE. |
| HB | Notification heartbeat. |
Object type
| Type | API source |
|---|---|
| TRACKABLE_OBJECT | See trackable objects |
| TRACKABLE_OBJECT_ASSOCIATION | See trackable objects |
| WIN_ANCHOR | See win_anchors |
| WIN_ANCHOR_ASSOCIATION | See win_anchors |
| NODE | See nodes |
| ZONE | See zones |
| ALARMS | See alarms |
| LOCATION | See locations |
| SUBLOCATION | See sublocations |
| FLOORPLAN | See floorplans |
| GROUP | See groups |
| PROJECT | See projects |
| NOTIFICATION | See notifications |
| SUBSCRIBER | See notifications |
Plist content
| Object | Action | Plist |
|---|---|---|
| TRACKABLE_OBJECT | created | Response fields in create trackables |
| TRACKABLE_OBJECT | updated | Response fields in update trackable |
| TRACKABLE_OBJECT | deleted | { uid: trackable_uid } |
| TRACKABLE_OBJECT_ASSOCIATION | created | Response fields in create trackable association |
| TRACKABLE_OBJECT_ASSOCIATION | updated | Response fields in update trackable association for update and close trackable association for close association |
| TRACKABLE_OBJECT_ASSOCIATION | deleted | { uid: association_uid } |
| WIN_ANCHOR | created | Response fields in create win anchors |
| WIN_ANCHOR | updated | Response fields in update win anchors |
| WIN_ANCHOR | deleted | { uid: win_anchor_uid } |
| WIN_ANCHOR_ASSOCIATION | created | Response fields in create association |
| WIN_ANCHOR_ASSOCIATION | updated | Response fields in update association |
| WIN_ANCHOR_ASSOCIATION | deleted | { uid: win_association_uid } |
| NODE | created | Response fields in create node |
| NODE | updated | Response fields in update node |
| NODE | assign | Response fields in assign node to project |
| NODE | release | Response fields in release node from project |
| NODE | deleted | { uid: node_uid } |
| ZONE | created | Response fields in case of polygon create zone in case of buffer create buffer |
| ZONE | updated | Response fields in update zone or buffer |
| ZONE | deleted | { uid: zone_uid } |
| ALARMS | created | Response fields in create alarm |
| ALARMS | updated | Response fields in update alarm |
| ALARMS | deleted | { uid: alarms_uid } |
| LOCATION | created | Response fields in create site |
| LOCATION | updated | Response fields in update site |
| LOCATION | deleted | { uid: location_uid } |
| SUBLOCATION | created | Response fields in create area |
| SUBLOCATION | updated | Response fields in update area |
| SUBLOCATION | deleted | { uid: sublocation_uid } |
| FLOORPLAN | created | Response fields in create floorplan |
| FLOORPLAN | updated | Response fields in update floorplan |
| FLOORPLAN | deleted | { uid: floorplan_uid } |
| GROUP | created | Response fields in create group |
| GROUP | updated | Response fields in update group |
| GROUP | deleted | { uid: group_uid } |
| PROJECT | created | Response fields in create project |
| PROJECT | updated | Response fields in update project |
| PROJECT | deleted | { uid: project_uid } |
| NOTIFICATION | created | Response fields in create notification |
| NOTIFICATION | updated | Response fields in update notification |
| NOTIFICATION | deleted | { uid: notification_uid } |
| SUBSCRIBER | created | Response fields in create subscriber |
| SUBSCRIBER | updated | Response fields in update subscriber |
| SUBSCRIBER | deleted | { uid: subscriber_uid } |
Notifications examples (notify channel)
Zone create example
In this example a zone is created.
{
"jsonrpc":"2.0",
"method":"notify",
"params":{
"subscription":"notify",
"data":{
"ts":1510916736,
"ms":396,
"object":"ZONE",
"action":"created",
"plist": {
"sublocation_id": null,
"zone_type_id": null,
"name": "Test1",
"default_allowed": false,
"priority": 0,
"zone_alarm_level": 1,
"sublocation_uid": "qbzuXXVkzRjysOkyJr1xWb",
"zone_type_name": "keep_out",
"zone_geometry": {
"positions": [
{
"x": "0",
"y": "0"
},
{
"x": "0",
"y": "100"
},
{
"x": "100",
"y": "100"
},
{
"x": "100",
"y": "0"
}
]
},
"dynamic": "false",
"shape": "polygon",
"trackable_object_uid": null,
"zone_exceptions": [],
"zone_points_attributes": [
{
"position_x": 0,
"position_y": 0,
"position_z": null
},
{
"position_x": 0,
"position_y": 100,
"position_z": null
},
{
"position_x": 100,
"position_y": 100,
"position_z": null
},
{
"position_x": 100,
"position_y": 0,
"position_z": null
}
],
"zone_mode": "ALWAYS_ACTIVE",
"schedule": {
"start_time": "00 01 * * *",
"stop_time": "00 02 * * *"
}
},
"project_uid":"jVrlR-ZERcmq0urnJ41Jgg",
"created_by":{
"uid":"reC1l2rWQraAqJyzL6Jr5A",
"email":"test@redpointpositioning.com"
}
}
}
}
Zone update example
In this example, the list of exceptions for a zone is modified.
{
"jsonrpc":"2.0",
"method":"notify",
"params":{
"subscription":"notify",
"data":{
"ts":1510916736,
"ms":396,
"object":"ZONE",
"action":"updated",
"plist":{
"sublocation_id":1,
"zone_type_id":2,
"depth":null,
"name":"Test KKO",
"created_at":"2017-11-17T10:54:33.000Z",
"updated_at":"2017-11-17T11:05:36.000Z",
"active":true,
"default_allowed":false,
"priority":0,
"zone_alarm_level":1,
"uid":"HGtHQspUS6qMLaeD3ZCXXg",
"sublocation_uid":"vFmP3l2hQOKwdqLcf4gfJg",
"zone_mode":null,
"zone_type_name":"keep_out",
"zone_geometry":{
"positions":[
{"x":-7270,"y":1433},
{"x":-7270,"y":3941},
{"x":-3955,"y":3941},
{"x":-3955,"y":1433}
]
},
"dynamic":false,
"shape":"polygon",
"trackable_object_uid":null,
"project_uid":"jVrlR-ZERcmq0urnJ41Jgg",
"location_uid":"w2XFKf6bRqKSG1XAz_CZEQ",
"zone_type":{
"id":2,
"display_name":"Keep Out",
"name":"keep_out"
},
"zone_exceptions":["2l-0mTzWQpusZXtW9vcKeg"],
"zone_exceptions_groups":[]
},
"project_uid":"jVrlR-ZERcmq0urnJ41Jgg",
"created_by":{
"uid":"reC1l2rWQraAqJyzL6Jr5A",
"email":"test@redpointpositioning.com"
}
}
}
}
Zone deleted example
In this example, a zone is deleted.
{
"jsonrpc":"2.0",
"method":"notify",
"params":{
"subscription":"notify",
"data":{
"ts":1510918964,
"ms":5,
"object":"ZONE",
"action":"deleted",
"plist":{
"uid":"nYjcn-8ZTRChE_PrbEzPtA"
},
"project_uid":"jVrlR-ZERcmq0urnJ41Jgg",
"created_by":{
"uid":"reC1l2rWQraAqJyzL6Jr5A",
"email":"test@redpointpositioning.com"
}
}
}
}
zone_event channel
Server generates zone events when trackables enter or leave zones. Note: zone events are also generated in the cases when the applicable trackable that is inside the zone becomes responsive and unresponsive, associated or disassociated. Zone configuration such as active or inactive and exception list trigger zone events too .
Zone event fields
| Name | Type | Values | Description |
|---|---|---|---|
| action | string |
|
Zone event action type. |
| ts | number | - | The timestamp part of zone event when it triggered, in seconds. |
| ms | number | - | The timestamp part of zone event when it triggered, in milliseconds. |
| obj_uid | string | - | Unique identifier of the trackable that triggered the event. |
| project_uid | string | - | Unique identifier of the project. |
| sublocation_uid | string | - | Unique identifier of the sublocation where event was triggered. |
| x | number | - | Coordinate X in mm of trackable’s position when event was triggered. |
| y | number | - | Coordinate Y |
| z | number | - | Coordinate Z |
| zone_type_name | string | - | Name of the zone type. |
| zone_uid | string | - | Unique identifier of the zone. |
'Zone enter' event example
{
"jsonrpc": "2.0",
"method": "notify",
"params": {
"subscription": "zone_event",
"data": {
"action":"enter",
"ts":1637677693,
"ms":869,
"obj_uid":"QIJBBeVWRvmNYYxigKuPvA",
"project_uid":"i7lONZPZTM6cI06btywj0Q",
"sublocation_uid":"GmmsFT8fT1OVkaZCTXU0TA",
"x":8747,
"y":4111,
"z":1000,
"zone_type_name":"keep_out",
"zone_uid":"lL9s8pAsT9aWjHIQeMxyQQ"
}
}
}
'Zone leave' event example
{
"jsonrpc":"2.0",
"method":"notify",
"params":{
"subscription":"zone_event",
"data":{
"action":"leave",
"ts":1637677707,
"ms":49,
"obj_uid":"QIJBBeVWRvmNYYxigKuPvA",
"project_uid":"i7lONZPZTM6cI06btywj0Q",
"sublocation_uid":"GmmsFT8fT1OVkaZCTXU0TA",
"x":8747,
"y":4111,
"z":1000,
"zone_type_name":"keep_out",
"zone_uid":"lL9s8pAsT9aWjHIQeMxyQQ"
}
}
}
alarm channel
The alarm channel is used to deliver alarms from trackables.
Alarm fields
| Name | Type | Values | Description |
|---|---|---|---|
| mac_address | string | - | The MAC address of the node that alarmed. |
| alarm_name | string |
|
The name of the alarm type. |
| additional_info | object | - | A json object with information about the alarm. |
| additional_info.zone_alarm_level | number | 1-4 | The severity level of the zone violation alarm, from 1-4, if the alarm is a zone violation. |
| additional_info.text | string | - | Text about the alarm. The field appears on the badge screen of the alarming tag when the alarm is generated. |
| additional_info.zone_violation_type | string |
|
The type of zone violation, if the alarm is a zone violation. |
| additional_info.zone_uid | string | - | The unique identifier of the zone, if the alarm is a zone violation. |
| acknowledged | number | - | Reserved field. |
| acknowledged_by | object | - | Reserved field. |
| created_at | string | - | The time when the alarm was triggered in UTC. |
| updated_at | string | - | The time when the alarm information was last updated in UTC. |
| alarm_type_id | number |
|
The numeric identifier of the alarm type in the context of the server. |
| hysteresis_count | number | - | The number of alarm publications. |
| status | string |
|
The current state of the alarm. The field is announced deprecated. It will be available for 6 months minimum(until May 2022). Please, use state instead. |
| state | string |
|
The current state of the alarm. |
| uid | string | - | The unique identifier of the alarm. |
| zone_uid | string | - | The unique identifier of the zone or buffer, if the alarm is a zone violation or a buffer violation. |
| obj_uid | string | - | The unique identifier of the trackable that triggered the alarm. |
| project_uid | string | - | The unique identifier of the trackable that triggered the alarm. |
| x | string | - | The X - coordinate of the trackable position when it triggered an alarm. |
| y | string | - | The Y - coordinate of the trackable position when it triggered an alarm. |
| z | string | - | The Z - coordinate of the trackable position when it triggered an alarm. |
| sublocation_uid | string | - | The unique identifier of the area. |
| ts | int | - | The timestamp part of alarm when it triggered, in seconds. |
| ms | int | - | The timestamp part of alarm when it triggered, in milliseconds. |
Alarm message zone violation example
In this example, an alarm zone_violation is triggered by the device.
{
"jsonrpc":"2.0",
"method":"notify",
"params":{
"subscription":"alarm",
"data":{
"additional_info":{
"zone_alarm_level":3,
"text":"Keep out zone New KO with zone alarm level 3",
"zone_violation_type":"keep_out",
"zone_uid":"mOB3p-wUR86biIXwqE1RWg"
},
"acknowledged":0,
"acknowledged_by":null,
"created_at":"2017-11-14T20:02:42.000Z",
"updated_at":"2017-11-14T20:02:42.000Z",
"alarm_type_id":2,
"hysteresis_count":1,
"state":"set",
"status":"set",
"uid":"uwKUTgF8TqSe92Y5_FS5GA",
"zone_uid":"mOB3p-wUR86biIXwqE1RWg",
"alarm_name":"zone_violation",
"obj_uid":"KCHEhmDkSlG0pLJpAlgDxw",
"project_uid":"jVrlR-ZERcmq0urnJ41Jgg",
"mac_address":"e4956ea50a8c",
"sublocation_uid":"GmmsFT8fT1OVkaZCTXU0TA",
"x":8517,
"y":1270,
"z":1000,
"ts":1510689762,
"ms": 101
}
}
}
Alarm message cleared example
In this example, an alarm zone_violation with the alarm id 85264 has been cleared and the device is no longer in the alarmed state.
{"jsonrpc":"2.0",
"method":"notify",
"params":{
"subscription":"alarm",
"data":{
"additional_info":{
"zone_alarm_level":3,
"text":"Keep out zone New KO with zone alarm level 3",
"zone_violation_type":"keep_out",
"zone_uid":"mOB3p-wUR86biIXwqE1RWg"
},
"acknowledged":0,
"acknowledged_by":null,
"created_at":"2017-11-14T20:02:42.000Z",
"updated_at":"2017-11-14T20:02:44.000Z",
"alarm_type_id":2,
"hysteresis_count":1,
"state":"clear",
"status":"clear",
"uid":"uwKUTgF8TqSe92Y5_FS5GA",
"zone_uid":"mOB3p-wUR86biIXwqE1RWg",
"alarm_name":"zone_violation",
"obj_uid":"KCHEhmDkSlG0pLJpAlgDxw",
"project_uid":"jVrlR-ZERcmq0urnJ41Jgg",
"mac_address":"e4956ea50a8c",
"sublocation_uid":"GmmsFT8fT1OVkaZCTXU0TA",
"x":8517,
"y":1270,
"z":1000,
"ts":1510689762,
"ms": 101
}
}
}