Remote calls, streams and events

DataMind Oda's screens and its extension packages call the host that serves them through one layer: short calls that carry a request and an answer, long-lived streams that carry items in both directions, and events the host forwards to the interface. This page is the reference for that layer, so you can read a trace, debug a connection or build a client of your own. For the authoring side, see Remote calls for extension authors and Remote APIs.

Calls

Streams

Streams are logical: they share the one WebSocket connection the client keeps open, each under its own stream id.

On a stream, each side sends a small set of frames:

FromFrameWhat it does
ClientopenOpens a logical stream, naming the method it calls and its arguments.
ClientitemSends one uplink item; its value may be omitted.
ClientendHalf-closes the uplink: no further items follow.
ClientcancelThe consumer has left; the stream is torn down.
HostitemDelivers one downlink value.
HosterrorEnds the stream with a failure: a code, a message and details.
HostendEnds the stream normally.

The session surface

Forwarded events

Account states

Limits

Close codes

A connection ends with a close code and, usually, a reason:

CodeReasonWhat it means
1000disposedThe client was disposed; the connection is closed for good.
1001peer leftThe peer's session ended, and its streams close with it.
1003text messages requiredA binary message arrived; the connection carries text only.
1008invalid Remote stream requestA malformed message, an unknown message type, or a duplicate open.
1011Remote stream failure could not be deliveredA stream failed and its failure could not be written, so the connection closed.
4000reconnect requestedThe client is making a fresh connection attempt; a new connection follows on its own.
4002an invalid frameA frame did not parse; every active stream fails and the connection closes.

When a call or stream fails

Questions, answered

What happens to open streams when the connection drops?

Nothing is replayed. When the client reconnects, each stream reopens on the new connection and re-reads the state it needs; items and notifications from the old connection are never sent again. While the replacement is being established, the interface keeps showing the state it already had. Connection states and recovery covers the recovery itself.

Why did the connection close with code 1008?

The reason invalid Remote stream request covers a malformed message, an unknown message type, or a second open for a stream id that is already open. Check the frames against the shapes on this page; a duplicate open is the one violation that closes the whole connection.

Why was my uplink item not lossless JSON?

The value used something the JSON subset does not admit, such as an undefined field, a big integer, NaN, an infinity, negative zero, a cycle, a class instance, or an accessor, hidden or symbol field. Send plain objects, dense arrays and ordinary JSON values instead. The stream the item was sent on fails with gateway/input-invalid.

Can two consumers watch the same stream?

No. A logical stream serves exactly one consumer, and opening a second one fails. When several parts of the interface need the same data, the client shares one stream between them instead of opening another.

How long may the connection stay silent?

It is pinged every two seconds by default, and that interval is also the deadline for the answer. A peer that misses two intervals in a row loses the connection. The interval is a deployment setting, so it can be raised where the default is too quick for the machines involved.

How much can a stream's uplink hold?

262,144 bytes (256 KiB) of frames by default. Over that, the stream fails with gateway/uplink-overflow and later items are dropped. Uplink items are never replayed, so anything that did not get through is lost.

Are forwarded events replayed after a reconnect?

One-way events are not: a notification missed while disconnected is gone. A request that is still waiting for an answer is different; it is sent again to the replacement connection so it can still be answered.

Which events can the interface subscribe to?

A fixed list, twenty-five entries in the current set: session changes (added, removed, status, activity, branches and errors), preset selection, goal activation changes, model adapter updates, permission catalogue changes, scheduled-task changes, settings updates, and the interface's own components (commands, credentials and plugins). An approval request and a user question are on the list as requests. A name outside the list is never forwarded.

What error does an aborted call settle as?

A cancelled failure, not a failure from the method: the code is gateway/cancelled and the message reads Remote invocation "<endpoint>" was aborted. Nothing further is kept for the answer.

Can a stale sign-in screen cancel a newer sign-in?

No. A cancellation names the specific sign-in attempt, so a screen that is out of date cannot cancel a sign-in that started after it, and an interface that reconnects reads the current account state again rather than resuming an old attempt.

How is this different from the Oda SDK?

They are different surfaces. This layer connects DataMind Oda's own screens and extensions to the host that serves them. The SDK is for a program of your own: a client process talks to a runtime over standard input and output, with the messages in the SDK wire protocol. Start from the Oda SDK overview, or read Automation clients for the serving profiles.