Skip to main content

foundation-comms.connect.streamstate

Home > @genesislcap/foundation-comms > Connect > streamState

Connect.streamState() method

Starts listening for updates on the specified resource.

Signature:

streamState(resourceName: string, onMessage: Function, onError: Function, params?: DataserverParams, initialState?: any[]): Observable<any[]>;

Parameters

Parameter

Type

Description

resourceName

string

The name of the resource to listen for updates on.

onMessage

Function

A callback function to handle received messages.

onError

Function

A callback function to handle errors.

params

DataserverParams

(Optional) Additional parameters to pass to the server.

initialState

any[]

(Optional) State of the list to start with, defaults to empty array.

Returns:

Observable<any[]>

An observable that emits latest state of the list it subscribes to.