Skip to content
Stand with Ukraine flag

gRPC protocol

ThingsBoard Edge communicates with the ThingsBoard server over a persistent, bidirectional gRPC streaming connection. All messages are serialized with Protocol Buffers. A single long-lived stream carries both directions of traffic — Edge sends telemetry and events upstream, and the server pushes configuration and entity assignments downstream.

The connection uses port 7070 by default, controlled by CLOUD_RPC_PORT.

When Edge starts, the Cloud Manager opens a stream to the server and sends a ConnectRequestMsg:

FieldDescription
edgeRoutingKeyThe Edge key generated when the Edge instance was provisioned on the server.
edgeSecretThe Edge secret generated alongside the routing key.
edgeVersionThe protocol version the Edge instance supports — used for backward compatibility.
maxInboundMessageSizeThe maximum gRPC message size Edge will accept, controlled by CLOUD_RPC_MAX_INBOUND_MESSAGE_SIZE (default 4 MB).

The server responds with a ConnectResponseMsg:

Response codeMeaning
ACCEPTEDThe credentials are valid and the connection is established.
BAD_CREDENTIALSThe routing key or secret is incorrect.
SERVER_UNAVAILABLEThe server accepted the TCP connection but cannot process Edge requests at this time.

On ACCEPTED, the server also sends an EdgeConfiguration payload containing the Edge instance ID, tenant ID, customer ID, name, type, and cloud type. Edge stores this configuration locally.

The EdgeVersion enum in the proto definition tracks the gRPC protocol version. Each ThingsBoard release that changes the message format introduces a new version value — for example, V_3_3_0, V_4_0_0, V_4_4_0.

When Edge connects, it declares its version in ConnectRequestMsg. The server uses this to determine which message fields and features the Edge instance supports, enabling a newer server to stay backward-compatible with older Edge nodes that have not been upgraded.

The stream carries four message types in each direction:

TypePurpose
ConnectRequestMsgInitiates the connection with credentials and protocol version.
UplinkMsgCarries telemetry, alarms, entity updates, and other events from Edge to the server.
DownlinkResponseMsgAcknowledges downlink messages received from the server.
SyncRequestMsgRequests the server to push all current state to Edge.
TypePurpose
ConnectResponseMsgReturns the connection result and Edge configuration.
DownlinkMsgCarries entity assignments, configuration changes, and other server-initiated messages.
UplinkResponseMsgAcknowledges uplink messages received from Edge.
EdgeUpdateMsgNotifies Edge of available software updates.

An UplinkMsg can carry one or more of the following payloads in a single batch. The Cloud Manager reads up to 50 events per batch from the cloud_events queue and sends them together.

CategoryPayload types
EntitiesDevice, asset, entity view, dashboard, rule chain, rule chain metadata, device profile, asset profile, user, user credentials, API key
Telemetry & attributesTelemetry data, attribute updates, attribute delete
AlarmsAlarm create/update, alarm acknowledgement, alarm clear, alarm comment
RelationsRelation add/update, relation delete
Sync requestsAttributes request, relation request, credentials request
ProcessingCalculated field, AI model, resource
RPCDevice RPC call response

A DownlinkMsg carries configuration and entity data pushed from the server to Edge. The server sends downlinks when an entity is assigned to Edge, when configuration changes, or in response to a SyncRequestMsg.

CategoryPayload types
EntitiesDevice, device profile, device credentials, asset, asset profile, entity view, customer, user, user credentials, tenant, tenant profile
Dashboards & UIDashboard, widget bundle, widget type, admin settings
Rule processingRule chain, rule chain metadata, queue, calculated field, AI model
AlarmsAlarm create/update, alarm comment
RelationsRelation add/update/delete
Device operationsRPC call request, OTA package
SecurityOAuth2 client, OAuth2 domain, API key
NotificationsNotification rule, notification target, notification template
InfrastructureEdge configuration, resource
SyncSync completed signal

The sync completed signal marks the end of a full sync sequence — Edge uses it to know that all pending downlinks have been delivered.

A SyncRequestMsg with fullSync=true instructs the server to push the complete current state — all assigned entities, rule chains, dashboards, and credentials — to Edge. This happens automatically on first connection and can be triggered manually via Force sync on the Edge instance details page on the server.

Without fullSync, the server sends only the delta since the last sync.