How to get Zone / GeoFence notifications?

You are here:
  • FAQ
  • API
  • How to get Zone / GeoFence notifications?

For obtaining notifications from the zones can be used WebSocket connector.

Communication is based on publish-subscribe model, where client can subscribe to stream from zone and be immediately updated about change.

Subscribe to zone changes:

{“headers”:{“X-ApiKey”:”YOUR_KEY”},”method”:”subscribe”, “resource”:”/zones/YOUR_ZONE_ID”}

Unsubscribe to zone changes:

{“headers”:{“X-ApiKey”:”YOUR_KEY”},”method”:”unsubscribe”, “resource”:”/zones/YOUR_ZONE_ID”}

Example of zone change, for example tag with ID 23 entered zone with ID 2 at particular UTC time:

{“body”:{“feed_id”:”23″,”zone_id”:”2″,”status”:”in”,”at”:”2016-10-26 09:30:58.428415″},”resource”:”\/zones\/2″}

or tag left that zone 1 minute later:

{“body”:{“feed_id”:”23″,”zone_id”:”2″,”status”:”out”,”at”:”2016-10-26 09:31:58.428415″},”resource”:”\/zones\/2″}

 

More about WebSockets in API Documentation in RTLS Studio.