Skip to main content

ProGlove Documentation

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 AcessToken acquired during authentication, your customerId, and the Live Data URL.

Subscribe

To connect the desired WebSocket client to INSIGHT webportal, you need to pass the following query parameter to the WebSocket base URL:

token=${ACCESS_TOKEN}

JavaScript example

let socket = new WebSocket("wss://dob66y4nv0.execute-api.eu-west-1.amazonaws.com/latest/?token=${ACCESS_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
}

Maintaining the connection

An idle connection will time out after 10 minutes. If the server or the user do not send any messages, the connection will automatically be closed on the server side after this period. To keep it active longer, you need to send a signal to the server on a regular basis. Sending the message {"action":"ping"} to the server within the 10-minute timeframe will result in the server responding with {"message":"pong"}. This will keep the connection active.

Note

The connection duration for WebSocket API has a maximum duration of two hours. After that a new connection needs to be re-established by the user.