Building a POC for real-time location in Entgra IoT Server
Live location is also a vital feature that enables IT admins to track the real-time location of devices belonging to the organization. The requirement was to develop a feature to track the real-time location of a device and display it on a map.
To achieve it, I developed a location callback and a WebSocket that provides full-duplex communication channels over a single TCP connection. Java is the language used in the Entgra IoT backend.
Figure 11: The flow of the real-time location feature of Entgra IoT Server
Whenever an admin loads the real-time location view of a device; it adds a new session to a session map. Then the location data of the device starts feeding data to the WebSocket through the location callback.
The session map holds multiple sessions of the devices with a unique key for the devices. The key is a combination of the device type, device ID, and tenant ID.
The UI is developed using ReactJS. I used the leaflet plugin[4] to render the map and I had to write a custom marker to rotate it according to the bearing of the device and to change the appearance of the marker according to the device’s availability.
Link to the work I have done:
https://gitlab.com/entgra/carbon-device-mgt/-/merge_requests/390