Live data connection
With Insight API, you can connect your applications to a live feed of events coming in to the system. This connection is established using the secure WebSocket WSS. To subscribe to the live feed, you need the IdToken
acquired during authentication, your customerId
, and the Live Data URL.
Subscribe
To connect the desired WebSocket client to ProGlove Insight Webportal, you need to pass two query parameters to the WebSocket base URL:
customer=${YOUR_CUSTOMER_ID} token=${JWT_TOKEN}
JavaScript example
let socket = new WebSocket("wss://dob66y4nv0.execute-api.eu-west-1.amazonaws.com/prod/?customer=${YOUR_CUSTOMER_ID}&token=${JWT_TOKEN}"); socket.onopen = function(event) { // called back if the connection has been established }; socket.onmessage = function(event) { // called if a scan event has been received for your account let scanEvent = event.data; // this holds a JSON with all the scans details }
JSON response
When a scan event is received, you get a callback on your message handler. The event data contain a JSON with the following information:
{ "api_version": "0.5", "time_created": 1598259269761, "customer_gateway_name": "Proglove Gateway", "customer_gateway_usecase": "Logistics", "customer_gateway_station": "Logistics", "device_serial": "M2SR121103132", "device_model": "Mark", "device_manufacturer": "Workaround GmbH", "device_firmware": "v1.2.0", "device_battery": 100, "event_type": "scan", "scan_code": "PGAS10603924", "scan_decode_symbology": "CODE 128", "event_id": "5a2eb866-f037-4b19-8122-82692ff64f93", "time_received": 1573116501587, "gateway_id": "36f00d2a-33a4-43ed-ba8e-2827f0c0ef08", "configuration_id": "ConfigurationId", "configuration_profile_id": "profile0", "configuration_profile_revision": 2, "configuration_tag": "5c0a65a07b5e15df", "gateway_firmware": "9", "gateway_manufacturer": "samsung", "gateway_model": "SM-J530F", "gateway_type": "mobile", "metrics": [{"metric_name": "bce_duration", "metric_type": "scalars", "metric_unit": "ms", "values": [270]}], "metrics_worker_steps": 3, "scan_duration": 0.27 }