WebSocket API

The WebSocket API is our preferred method of delivering you your end-device data as it is:

  • Cloud-friendly (existing HTTP traffic optimisation can be used)
  • Bi-directional, real-time interface
  • Easy to implement
  • Lower overhead compared to REST
  • Supported in all major web browsers and many programming languages

For more information about WebSockets the RFC is a good starting point. In simple terms, it’s just a protocol on top of HTTP, initiated by a HTTP Upgrade request.

Our sample WebSocket application (view page source to see code) can help your development.

We only support secure (TLS) WebSockets. Plaintext WebSockets are not allowed.

How to connect

Contact KotahiNet to change the data output to WebSocket and provide you with your specific WebSocket URL. It will be in the format wss://au1.loriot.io/app?token={token}.

Using your favourite programming language, connect to the WebSocket.

Once you get a 101 response to your Upgrade request, the WebSocket connection has succeeded and can listen for incoming data as well as be used to send data to your devices.