Class: StreamManager

stream-manager~StreamManager(serverUrl, streamConfiguration, connectionHandlers, messageHandlers, optionsopt)

Provides support for creating a new WicaStream on the Wica server, for subscribing to it and for publishing the received information.

Constructor

new StreamManager(serverUrl, streamConfiguration, connectionHandlers, messageHandlers, optionsopt)

Constructs a new instance. The returned object will remain in a dormant state until triggered by a call to the activate method.
Parameters:
Name Type Attributes Description
serverUrl string The URL of the server that will create the new stream.
streamConfiguration Object The stream specification sent to the server, including channel configurations and optional stream properties.
Properties
Name Type Attributes Description
channels Array.<{name:module:shared-definitions.WicaChannelName, properties: module:shared-definitions.WicaChannelProperties}> Object specifying the configuration of each wica channel in the stream.
props module:shared-definitions.WicaStreamProperties <optional>
Optional stream-level properties.
connectionHandlers Object Callback functions for handling connection state changes.
Properties
Name Type Description
streamConnect module:stream-manager.StreamConnectCallback Called when the stream manager begins a new connect sequence. See module:stream-manager.StreamConnectCallback.
streamOpened module:stream-manager.StreamOpenedCallback Called when the stream is successfully opened. See module:stream-manager.StreamOpenedCallback.
streamClosed module:stream-manager.StreamClosedCallback Called when the stream is closed. See module:stream-manager.StreamClosedCallback.
messageHandlers Object Callbacks for handling SSE data messages.
Properties
Name Type Description
channelMetadataUpdated module:stream-manager.ChannelMetadataUpdatedCallback Called when new channel metadata is received. See module:stream-manager.ChannelMetadataUpdatedCallback.
channelValuesUpdated module:stream-manager.ChannelValuesUpdatedCallback Called when new channel value data is received. See module:stream-manager.ChannelValuesUpdatedCallback.
options Object <optional>
Optional client-side configuration.
Properties
Name Type Attributes Description
streamTimeoutIntervalInSeconds number <optional>
Maximum permitted interval between heartbeat messages.
streamReconnectIntervalInSeconds number <optional>
Delay between reconnect attempts after an outage.
crossOriginCheckEnable boolean <optional>
Whether CORS origin checks should be performed.
asyncStreamDeleteEnable boolean <optional>
Whether to delete the stream using navigator.sendBeacon (true) or a blocking HTTP DELETE request (false).

Methods

activate()

Activates this stream manager instance. More specifically this sets up a state machine to create and manage an active event stream and for calling other handlers as required to track the evolving connection state and received data. See also: module:stream-manager.StreamManager#shutdown.

shutdown()

Shuts down this stream manager instance. See also: module:stream-manager.StreamManager#activate.