attachChannel

fun attachChannel(channel: Channel, isRealtime: Boolean? = null): Deferred<OperationResult>

attachChannel attaches the given channel counter to this client. It registers the channel locally; the server is notified by the first RefreshChannel heartbeat, which creates the session and — for a client that never called activateAsync — activates the client lazily.

The returned Deferred completing only means local registration. Server-side attach finishes asynchronously: observe ChannelEvent.Initialized/ChannelEvent.Changed or Channel.getSessionId for server state. Requires a Yorkie server >= 0.7.10.

Parameters

channel

The channel counter to attach.

isRealtime

If true (default), starts watching for channel changes in realtime. If false, uses manual sync mode where you must call syncAsync to refresh the channel count.