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 4 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.
device_api_version
console_version
Related
Was this helpful?
More in Reference
Self-hosting configuration referenceCLI reference (nh)Still need help? Ask the team