Skip to main content
Access via:io.channels

Channels API.

Properties (1)

Property Type Default Required Description
mode⚓︎ OperationMode "single"

Retrieves the current Channel mode (single or multi Channel). Set by the io.Connect framework based on configuration.

io.Connect Desktop 9.7

24 Methods

add()⚓︎

(info: ChannelContext) => Promise<ChannelContext>

Adds a new Channel.

Parameters (1)

Name Type Required Description
info⚓︎ ChannelContext

Initial Channel context.

all()⚓︎

() => Promise<string[]>

Retrieves a list of all Channel names.

clearChannelData()⚓︎

(channel?: string) => Promise<void>

Clears the context data of the current Channel. The data property of the Channel context is set to an empty object. Pass a Channel name as an argument to clear the data of a specific Channel.

io.Connect Desktop 9.8

Parameters (1)

Name Type Required Description
channel⚓︎ string x

Name of the Channel whose context data to clear.

get()⚓︎

(name: string, options?: FDC3Options) => Promise<ChannelContext>

Retrieves the context of a specified Channel.

Parameters (2)

Name Type Required Description
name⚓︎ string

The name of the Channel whose context to retrieve.

options⚓︎ FDC3Options x

Settings for retrieving an FDC3 context published in the io.Connect Channel. Available since io.Connect Desktop 9.6.

getMy()⚓︎

(options?: FDC3Options) => Promise<ChannelContext>

Retrieves the context of the current Channel. It's recommended to use the getMyChannels() method instead, which can retrieve the contexts of the currently joined Channels both in single and in multi Channel mode.

Parameters (1)

Name Type Required Description
options⚓︎ FDC3Options x

Settings for retrieving an FDC3 context published in the io.Connect Channel. Available since io.Connect Desktop 9.6.

getMyChannels()⚓︎

(options?: FDC3Options) => Promise<ChannelContext[]>

Retrieves a list with the contexts of the current Channels. Can be used both in single and in multi Channel mode. If used in single Channel mode, the returned array will always contain a single member if the window is joined to a Channel, or will be empty otherwise.

io.Connect Desktop 9.7

Parameters (1)

Name Type Required Description
options⚓︎ FDC3Options x x

getRestrictions()⚓︎

(windowId?: string) => Promise<Restrictions>

Retrieves the restrictions applied to the current window for publishing or subscribing to Channels. Pass a window ID to retrieve the restrictions for the specified window.

io.Connect Desktop 9.3

Parameters (1)

Name Type Required Description
windowId⚓︎ string x

ID of the window for which to retrieve the applied restrictions for publishing or subscribing to Channels.

getWindowsOnChannel()⚓︎

(channel: string) => Promise<IOConnectWindow[]>

Retrieves all windows on a specified Channel.

Parameters (1)

Name Type Required Description
channel⚓︎ string x

getWindowsWithChannels()⚓︎

Retrieves all windows that can use Channels together with their current Channel.

Parameters (1)

Name Type Required Description
filter⚓︎ WindowWithChannelFilter x

Filter describing which windows to retrieve. If no filter is supplied, will return all windows that can use Channels.

join()⚓︎

(name: string, windowId?: string) => Promise<void>

Joins a new Channel by name. Leaves the current Channel.

Parameters (2)

Name Type Required Description
name⚓︎ string

The name of the Channel to join.

windowId⚓︎ string x

ID of a window which to join to a Channel. If not provided, will join the current window to the specified Channel.

leave()⚓︎

(options?: string | { windowId?: string, channel?: string }) => Promise<void>

Removes the current or a specified window from the current or a specified Channel.

Parameters (1)

Name Type Required Description
options⚓︎ string | { windowId?: string, channel?: string } x

Options for leaving Channels. You can provide only the window ID, or an object holding the window ID and the name of the Channel to leave. In either case, if only a window ID is provided, the specified window will be removed from the current Channel if in single Channel mode, or from all currently joined Channels if in multi Channel mode. If you provide only the name of the Channel to leave, the current window will be removed from the specified Channel. If you don't provide an argument, the current window will be removed from the current Channel if in single Channel mode, or from all currently joined Channels if in multi Channel mode.

list()⚓︎

() => Promise<ChannelContext[]>

Retrieves a list of all Channel contexts.

my()⚓︎

() => string

Retrieves the name of the current Channel. It's recommended to use the myChannels() method instead, which can retrieve the names of the currently joined Channels both in single and in multi Channel mode.

myChannels()⚓︎

() => string[]

Retrieves a list with the names of the current Channels. Can be used both in single and in multi Channel mode. If used in single Channel mode, the returned array will always contain a single member if the window is joined to a Channel, or will be empty otherwise.

io.Connect Desktop 9.7

onChanged()⚓︎

(callback: (channel: string) => void) => () => void

Notifies when the current window joins or leaves a Channel. Returns an unsubscribe function. It's recommended to use the onChannelsChanged() method instead, which can handle Channel changes both in single and in multi Channel mode.

Parameters (1)

Name Type Required Description
callback⚓︎ (channel: string) => void

Callback function for handling the event. Receives as an argument the name of the newly joined Channel. If the window leaves a Channel without joining a new one, the argument will be undefined.

onChannelsChanged()⚓︎

(callback: (channels: string[]) => void) => () => void

Notifies when the current window joins or leaves a Channel. Can be used both in single and in multi Channel mode. If used in single Channel mode, when the window joins a Channel, the array argument passed to the callback for handling the event will always contain a single member; when the window leaves the current Channel, the array will be empty. Returns an unsubscribe function.

io.Connect Desktop 9.7

Parameters (1)

Name Type Required Description
callback⚓︎ (channels: string[]) => void

Callback function for handling the event. Receives a list with the names of the currently joined Channels as an argument.

publish()⚓︎

(data: any, options?: string | PublishOptions) => Promise<void>

Updates the context of the current or a specified Channel.

Parameters (2)

Name Type Required Description
data⚓︎ any

Data object with which to update the Channel context.

options⚓︎ string | PublishOptions x

The name of the Channel to update, or an object containing the name of the Channel to update and a flag indicating whether the published data is an FDC3 context. If no options are provided, the current Channel will be updated.

remove()⚓︎

(channel: string) => Promise<void>

Removes a Channel.

Parameters (1)

Name Type Required Description
channel⚓︎ string

The name of the Channel to remove.

restrict()⚓︎

(restrictions: ChannelRestrictions) => Promise<void>

Prevents or allows the current or another window to publish or subscribe to a specific Channel.

io.Connect Desktop 9.3

Parameters (1)

Name Type Required Description
restrictions⚓︎ ChannelRestrictions

Restrictions for publishing or subscribing to a specific Channel.

restrictAll()⚓︎

(restrictions: RestrictionsConfig) => Promise<void>

Prevents or allows the current or another window to publish or subscribe to all Channels.

io.Connect Desktop 9.3

Parameters (1)

Name Type Required Description
restrictions⚓︎ RestrictionsConfig

Restrictions for publishing or subscribing to all Channels.

setPath()⚓︎

(path: PathValue, name?: string) => Promise<void>

Sets a specified path within the Channel context to the provided value. If the path doesn't exist, it will be created.

Parameters (2)

Name Type Required Description
path⚓︎ PathValue

Object containing the path to update and the value with which to update it. The path must be specified as a dot-separated string (e.g., "prop1.prop2").

name⚓︎ string x

Name of the Channel to update. If not specified, will update the current Channel.

setPaths()⚓︎

(paths: PathValue[], name?: string) => Promise<void>

Sets a list of specified paths within the Channel context to the provided values. If a path doesn't exist, it will be created.

Parameters (2)

Name Type Required Description
paths⚓︎ PathValue[]

List of objects each containing a path to update and the value with which to update it. The path must be specified as a dot-separated string (e.g., "prop1.prop2").

name⚓︎ string x

Name of the Channel to update. If not specified, will update the current Channel.

subscribe()⚓︎

(callback: (data: any, context: ChannelContext, updaterId: string) => void, options?: FDC3Options) => () => void

Subscribes for data updates of the current Channel. Persisted after a Channel change. Returns an unsubscribe function.

Parameters (2)

Name Type Required Description
callback⚓︎ (data: any, context: ChannelContext, updaterId: string) => void

Callback function for handling the received data. The callback receives as arguments the updated Channel data, the current Channel context and the ID of the updating app instance.

options⚓︎ FDC3Options x

Settings for subscribing to an FDC3 context published in the io.Connect Channel. Available since io.Connect Desktop 9.6.

subscribeFor()⚓︎

(name: string, callback: (data: any, context: ChannelContext, updaterId: string) => void, options?: FDC3Options) => Promise<() => void>

Subscribes for data updates of a specified Channel. Resolves with an unsubscribe function.

Parameters (3)

Name Type Required Description
name⚓︎ string

The Channel to which to subscribe.

callback⚓︎ (data: any, context: ChannelContext, updaterId: string) => void

Callback function for handling the received data. The callback receives as arguments the updated Channel data, the current Channel context and the ID of the updating app instance.

options⚓︎ FDC3Options x

Settings for subscribing to an FDC3 context published in the io.Connect Channel. Available since io.Connect Desktop 9.6.