Device socket & channel API
The websocket protocol devices use to talk to NervesHub: connection, authentication, channels, messages, and API versions.
Written By Josh Kalderimis
Last updated About 2 months ago
Devices talk to NervesHub over a long-lived websocket. This is the protocol the NervesHubLink client implements. You rarely need these details unless you're building your own client or debugging the connection.
Connecting and authenticating
A device connects to the device endpoint websocket and authenticates one of two ways:
Certificate (mTLS): the TLS client certificate presented during the handshake.
Shared secret: an HMAC token passed in connection headers.
See Device authentication & mTLS for how each is verified.
Channels
Once connected, the device joins channels:
Device channel messages
Device β server
Server β device
API versions
The client reports two internal version numbers so the server knows what it supports.