Skip to content

WebSockets integration

This path allows you to integrate Insight Mobile with your system using WebSockets if you are running your apps as web apps on desktop, handheld devices, or even hybrid mobile apps.

You can run a WebSocket server inside Insight Mobile and other apps, either running on the same device or a local network (e.g. LAN, VPN). WebSocket supports two-way communication, so both the server and client can send and listen for messages/events.
Here, we have implemented the Streams API to define events and messages that can be exchanged between the customer's and ProGlove apps (i.e. WebSocket clients and Insight Mobile WebSocket server).

Devices and communication setup

The WebSocket server is running on localhost.


Select WebSocket integration path

  1. In Insight Webportal, under Device Visibility, select Configurations.
  2. At the top right, click the + icon to add a configuration.
  3. Select Insight Mobile (Android) and select Next.
  4. Under Connectivity Settings, select WebSocket.
  5. Enter the Port Number.
  6. At the bottom of the page, select Save.
    A modal Assign a Name for the Configuration window displays.
  7. Type in the name of your configuration and select Next.
    The modal Apply the Configuration window displays the Configuration Barcode.
  8. Scan the generated barcode with the scanner connected to Insight Mobile. The configuration is applied to the scanner and the Insight Mobile Android app.
  9. Select Save.
  10. Use the ws://localhost: address followed by your Port Number (e.g. ws://localhost:9998), to connect to the WebSocket server and communicate using Streams API messages.

TCP/IP limitations

Although ports can technically be integers lower than 1024, and port 80 is usually considered the default for WebSocket (ones that do note use SSL), a server running on ports lower than 1024 requires special root privileges on the running OS. As we cannot know the state of the customers' devices, we do not recommend using the WebSockets integration with ports lower than 1024. Additionally, as the TCP protocol does not allow port numbers 65536 and larger, the ports should be in the range of [1024,65536), or [2^10, 2^16).