Filter results by

Choose a WebSocket type

Using a WebSocket, you can set up a near real-time connection between ARTIK cloud services and compatible devices or applications. The connection allows:

  • an application to monitor and control devices.
  • a device to send messages and receive Actions.

There are three WebSocket types: device channel, Firehose, and event feed.

To help you decide which one to use, we'll present some typical use cases for each type. See our WebSockets documentation to learn about the details!

Device channel WebSocket

Both devices and applications can use device channel WebSockets.

Devices

For a device to send messages and receive Actions in near real-time, it must connect to ARTIK cloud services via a persistent connection. A device channel WebSocket is one way to establish a persistent connection. (See "persistent connection" in the Glossary for other ways). When registering, the device must use a device token as its access token.

Check out these samples to see device code implementation details: Java starter code, Python starter code, Node.js starter code.

Applications

An application must use a device channel WebSocket to send Actions to devices in near real-time. The application is allowed to register and control multiple devices on one device channel. When registering, the application must use an application or user token. The application token is preferred when controlling devices across users (e.g. a backend server application).

See An IoT remote control app for implementation details.

Firehose WebSocket

Only applications, not devices, should use a Firehose WebSocket. An application uses a Firehose to listen to messages sent by source devices. When connecting to a Firehose, the application specifies which devices to monitor. It then receives messages in near real-time when they are sent by these devices to ARTIK cloud services. The application must use an application or user token when establishing a Firehose connection. The application token is preferred when monitoring devices across users (e.g. a backend server application).

Messages sent over a Firehose WebSocket are not rate limited. See An IoT remote control app for implementation details.

Event feed WebSocket

As with the Firehose WebSocket, only applications, not devices, should use an event feed WebSocket. With an event feed, an application receives status updates of specified devices or user profiles. Examples of supported events are device creation/deletion and device online/offline. The application must use an application or user token when establishing an event feed connection. The application token is preferred when monitoring devices across users (e.g. a backend server application).

Event updates sent over an event feed WebSocket are not rate limited. See the Java sample application for implementation details.