Websocket API

The websocket API is used for streaming updates, like progress reports from devices when they are sampling, or status messages for jobs. To authenticate with the websocket API you'll need a socket token, which you can acquire through the Get socket token API.

🚧

Unstable API

This is an unstable API, and it might change without prior notice.

Connecting to the API

To connect to the websocket API, connect to:

wss://studio.edgeimpulse.com/socket.io/?token=XXX&EIO=3&transport=websocket

Replace XXX with the socket token you obtained through Get socket token. If the connection succeeds you'll get a response like:

42["hello",{"hello":{"version":1},"devices":[]}]

(42 might be replaced by a different number).

Keep-alive

While connected to the websocket API you'll need to ping at least every 29 seconds. To do so send the string 2.

End-to-end example: Streaming job logs

An end-to-end example in TypeScript which starts a job, then streams the logs, and monitors whether the job succeeds can be found here: classification-loader.ts.