When your device connects
- Omega starts the
device-rpcmodule and connects to Golain over MQTT. - Golain learns which gRPC services and methods the device exposes (for example
golain.device.v1.EchoServicewith methodsEchoandEchoServerStream). - Golain stores the schema for your project and binds it to this device.
- The device is ready to call — list services from the management API or invoke directly.
When you call a method
Unary (sync invoke)
- Your app sends an HTTP POST with a JSON body to the RPC host (
https://rpc.ilyama.golain.io) —/{Service}/{Method}in the URL, no/core/api/v1prefix. - Golain checks your token, organization, and
can_invoke_rpcpermission on the device. - Golain delivers the call to the device and waits for the handler to finish.
- Golain converts the response to JSON and returns it to your app.
?session_id= on the invoke URL groups calls for later audit queries. See Invoking methods for headers, URL shape, and examples.
Server-stream (SSE)
- Your app POSTs to the RPC host with
/streams/{Service}/{Method}in the URL andAccept: text/event-stream. - Golain checks auth and permissions the same way as unary invoke.
- Golain opens a server-streaming call to the device and relays each response message as an SSE
messageevent (base64 protobuf). - The stream ends with an
endevent, orerror/cancelledon failure.
curl -N so the client does not buffer events. See Stream a method (SSE).
Your device’s MQTT root topic and device name must match what you registered in the Console. A mismatch causes invoke or schema errors even when MQTT looks healthy. See Omega setup.
Cloud invoke by method type
The bundled echo example includes all four shapes. From the cloud, call
Echo (unary) or EchoServerStream (server-stream). EchoClientStream and EchoBidiStream are for device-local testing.
Queued calls
When the device may be offline, use the enqueue path instead of a blocking invoke. Golain stores the request and delivers it when the device is available; you poll for the result. Queued invoke is unary-only — there is no enqueue path for streams. Delivery is at-least-once, so handlers should be idempotent. See Queued invoke for enqueue, poll, and retry behavior.Related
- Overview — concepts and prerequisites
- Omega setup — enable device-rpc and verify connect
- Invoking methods — HTTP caller guide
- Queued invoke — offline delivery
- Troubleshooting — when connect or invoke fails