Class: StreamManager

stream-manager~StreamManager(serverUrlnon-null, streamConfigurationnon-null, connectionHandlersnon-null, messageHandlersnon-null, optionsnon-null)

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

Constructor

new StreamManager(serverUrlnon-null, streamConfigurationnon-null, connectionHandlersnon-null, messageHandlersnon-null, optionsnon-null)

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 Description
serverUrl string The URL of the server to contact to request the creation of the new stream.
streamConfiguration Object The stream specification to be sent to the server. This includes the configuration of each of the stream's channels, together with, optionally, the stream properties object.
Properties
Name Type Attributes Description
channels Array.<WicaChannelName, module:shared-definitions.WicaChannelProperties> Array specifying the configuration of each stream channel. See WicaChannelName and WicaChannelProperties.
props WicaStreamProperties <optional>
The stream properties object. See WicaStreamProperties.
connectionHandlers Object Callbacks for handling connection state changes.
Properties
Name Type Description
streamConnect module:stream-manager.StreamConnectCallback Called when the stream manager begins a new connect sequence. This occurs after the stream manager activate method has been invoked, or if the stream manager doesn't see a stream heartbeat message within the expected time interval. See StreamConnectCallback.
streamOpened module:stream-manager.StreamOpenedCallback Called when the stream is opened. See StreamOpenedCallback.
streamClosed module:stream-manager.StreamClosedCallback Called when the stream is opened. See StreamClosedCallback.
messageHandlers Object Callbacks for handling data received from the SSE stream.
Properties
Name Type Description
channelMetadataUpdated module:stream-manager.ChannelMetadataUpdatedCallback Called when channel metadata information is received. See ChannelMetadataUpdatedCallback.
channelValuesUpdated module:stream-manager.ChannelValuesUpdatedCallback Called when channel value information is received. See ChannelValuesUpdatedCallback.
options Object Provides additional client-side configuration options.
Properties
Name Type Attributes Description
streamTimeoutIntervalInSeconds number <optional>
Periodicity with which the stream's heartbeat message needs to be received before the manager will conclude that a communication outage has occurred.
streamReconnectIntervalInSeconds number <optional>
Period between successive reconnection attempts following a communication outage.
crossOriginCheckEnable boolean <optional>
Whether this manager should perform a CORS check to verify that the origin of the event stream is the same as the origin from which this manager was loaded.
asyncStreamDeleteEnable boolean <optional>
Defines how this manager will send stream delete requests to the wica stream server when the manager is shutdown. Set true to enable the modern navigator.sendBeacon based approach. Set false to use a conventional blocking HTTP DELETE approach.

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: shutdown.

shutdown()

Shuts down this stream manager instance. See also: activate.