Skip to main content

ProGlove Documentation

Websocket integration

Allows you to integrate the ProGlove INSIGHT Mobile (Android) app with your system using WebSocket, if you are running your apps as web, hybrid, or native mobile apps.

Websocket integration supports two-way communication, so both the server and the client can send and listen for messages / events.

Streams API is used 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.

WebSocketNew.png
Select Websocket integration path
  1. On Insight Webportal, under Device Visibility, select Configurations.

  2. At the top right, click New Configuration, to add a configuration.

    Add_config.png
  3. Select Insight Mobile (Android) as a device and select Next.

    AndroidConfiguration_SelectDevice.png
  4. Type in a unique name for your configuration and click Next.

  5. On the Integrations tab, select Websocket.

  6. Enter the Port Number.

    Note

    Predefined port number (9998) appears in this field but can be changed at any time.

  7. At the bottom of the left menu, click Save.

    Config_3_0_SaveConfig_Websocket.png
  8. Type in the name of your configuration and select Next.

    The modal Apply your configuration via window displays the Configuration Barcode.

    ApplyConfigAN_noString.png
  9. Scan the generated barcode with the scanner connected to Insight Mobile.

    The configuration is applied to the scanner and the Insight Mobile Android app.

  10. Select Save.

  11. 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 WebSocket default (ones that do note use SSL), servers running on ports lower than 1024 require 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 path with ports lower than 1024. Additionally, as the TCP protocol does not allow port numbers 65536 and higher, we recommend you adhere to the port range between 1024 and 65536 [2^10 - 2^16).

TIME_WAIT state in TCP protocol limitation

There are certain limitations when reconfiguring the WebSocket integration on the same server port due to the design of the TIME_WAIT state for protocols and scalable client server systems.

If you connect to a port (e.g., ws://localhost:9876), disconnect and then try to connect the same port again, you will get an error. If you try to reconnect using the same configuration but to a different port, it will work normally. This is due to the TIME_WAIT state into which some sockets can enter and remain in for a relatively long periods of time. To learn more about the behavior, see this article.

If you must disconnect from the port and reconnect to the same one, you can:

  • Restart the client app

  • Restart Insight Mobile Android

  • Give it enough time for the TCP protocol to release the port.

The Display over other apps permission

Starting from Android 10 (API level 29), it is not possible to start an Activity from the background unless the customer has granted a specific permission - Display over other apps. If this permission is not granted, the pairing barcode will not display on the screen and the scanner will not be able to connect.

To grant the Display over other apps permission:

  1. On your Android device, go to Settings.

  2. Open Apps & Notifications.

  3. Under Insight Mobile app, select Advanced.

  4. Under Display over other apps, select Allow.