Inband Objects

Inband objects enables clients to subscribe to LiveObjects updates in realtime, even on platforms that don’t yet have a native LiveObjects Realtime client implementation.

Inband objects works by delivering changes to channel objects as regular channel messages, similar to inband occupancy .

To enable inband objects, use the objects channel parameter when getting a channel:

JavaScript v2.9
// When getting a channel instance const channelOpts = { params: { objects: 'objects' } }; const channel = realtime.channels.get('my-channel', channelOpts); // Or using setOptions on an existing channel await channel.setOptions({ params: { objects: 'objects' } });
Copied!

When using inband objects, the client will receive special [meta]objects messages whenever the objects on the channel are updated. These messages provide a snapshot of the current set of objects on the channel.

Subscribe to [meta]objects messages like you would any other message on the channel. For convenience, use a message name filter to only receive messages with the name [meta]objects in your listener:

JavaScript v2.9
// Subscribe to [meta]objects messages channel.subscribe('[meta]objects', (message) => { const { syncId, nextCursor, object } = message.data; console.log("Received inband objects message:", syncId, nextCursor, JSON.stringify(message.data)); });
Copied!

Inband objects messages are sent as a sequence of messages, where each message contains a snapshot of a single object on the channel. Taken together, a set of messages belonging to the same sequence describes the complete set of objects on the channel.

Each inband objects message has a message name of [meta]objects.

The message data is a JSON object with the following top-level properties:

  • syncId: A unique ID for this sequence. All messages with the same syncId are part of the same sequence of messages which describes the complete set of the objects on the channel.
  • nextCursor: A cursor for the next message in the sequence, or undefined if this is the last message in the sequence.
  • object: A JSON representation of the object included in the message.

The shape of the object is the same as the response format of an object when listing them via the REST API .

Select...