Hierarchy

  • StreamLink

Methods

  • Adds a connection listener with this StreamLink instance. This connectionListener is called whenever a connection event occurs.

    Parameters

    Returns void

  • Instructs this StreamLink instance to attempt to connect to the Liberator.

    When a ConnectionListener has been registered with this StreamLink instance, the listener's methods are called when the status of the connection changes.

    Returns void

  • Creates a subject.

    This method can be used to send a POST message to a configured REST endpoint.

    Parameters

    • subject: string

      The subject to create.

    • commandParameters: CommandParametersObject

      command parameters.

    • commandListener: CommandResultListener

      A listener that receives notification of the create command's success or failure plus any return value.

    Returns CommandSubscription

    Information about the 'create' command. If the commandParameters made the command persistent, you can subsequently cancel this by calling the CommandSubscription's unPersist() method.

    Description

    The commandParameters argument takes the following JSON configuration attributes:

    Attribute name Type Default Optional Description
    payload object null Yes

    The payload associated with this command, the payload should be of the type specified by the payloadType attribute.

    payloadType PayloadType PayloadType.JSON Yes

    The type of the payload.

    persistent boolean false Yes

    When true, if the connection to the Liberator fails after publication, the data is resent when StreamLink reconnects.

    When false, if the connection to the Liberator fails after publication, the data is not resent when StreamLink reconnects.

    cancellable boolean false Yes

    Sets the command associated with these parameters to be cancelled in the event that the connection goes down before it is sent.

    headers [{header:"header1", value:"value1"}, {header:"header2", value:"value2"}, ...] Array of HTTP headers applied to the mapped REST enndpoint. Yes Applies HTTP headers to the REST endpoint, applies only to subjects mapped to REST endpoints in the Liberator.

    Function

  • Creates a Channel for the specified subject on the Liberator.

    Use the returned channel to send and receive data as maps of name/value pairs.

    Parameters

    • subject: string

      the Liberator subject that will be used for this channel.

    • channelListener: ChannelListener

      to receive data, status and error messages from the channel.

    • Optional commandParameters: any

      Optional JSON configuration attributes.

    Returns Channel

    channel object that can be used to send and receive data as maps of name/value pairs.

    Description

    The commandParameters argument takes the following JSON configuration attributes:

    Attribute name Type Default Optional Description
    persistent boolean false Yes

    When true, the latest channel record data sent persists across a failure of the connection to Liberator and subsequent reconnection.

    When false, the record data only applies to the current Liberator session and does not persist following a connection failure.

    For a fuller explanation, see the 'Persistence' section of the StreamLink Overview document.

    cancellable boolean false Yes

    Sets the sending of record data associated with this channel to be cancelled in the event that the connection goes down before it is sent.

  • Creates a JsonChannel for the specified subject on the Liberator.

    Use the returned channel to send and receive JSON data.

    Parameters

    • subject: string

      the Liberator subject that will be used for this channel.

    • channelListener: JsonChannelListener

      to receive data, status and error messages from the channel.

    • Optional commandParameters: any

      Optional JSON configuration attributes.

    Returns JsonChannel

    channel object that can be used to send and receive JSON data.

    Description

    The commandParameters argument takes the following JSON configuration attributes:

    Attribute name Type Default Optional Description
    persistent boolean false Yes

    When true, the latest channel record data sent persists across a failure of the connection to Liberator and subsequent reconnection.

    When false, the record data only applies to the current Liberator session and does not persist following a connection failure.

    For a fuller explanation, see the 'Persistence' section of the StreamLink Overview document.

    cancellable boolean false Yes

    Sets the sending of record data associated with this channel to be cancelled in the event that the connection goes down before it is sent.

  • Creates a subject in the Liberator.

    Parameters

    • subject: string

      The name of the subject to create.

    • subjectType: SubjectType

      The type of subject to create.

    • commandListener: CommandListener

      A listener that is called to provide information about the result of the "create subject" command.

    • Optional commandParameters: any

      Optional JSON configuration attributes.

    Returns CommandSubscription

    Information about the 'create subject' command. If the commandParameters made the command persistent, you can subsequently cancel this by calling the CommandSubscription's unPersist() method.

    Description

    The commandParameters argument takes the following JSON configuration attributes:

    Attribute name Type Default Optional Description
    persistent boolean false Yes

    Sets the command associated with these parameters to be persistent. This deals with the situation where the connection to the Liberator server has been lost, and on subsequent reconnection StreamLink must create a brand new user session and log in to Liberator again. When this happens, the "persistent" command is automatically re-sent to the Liberator.

    cancellable boolean false Yes

    Sets the command associated with these parameters to be cancelled in the event that the connection goes down before it is sent.

  • Creates a WebRequestParameters object for the specified Liberator web module.

    The returned WebRequestParameters object contains the URL and HTTP post body that should be used to access the required web module.

    Parameters

    • moduleName: string

      the name of the Liberator web module.

    • options: {
          [key: string]: string;
      }

      a map of named options that the web module accepts.

      • [key: string]: string

    Returns WebRequestParameters

    an object of type WebRequestParameters or null if the module is not available or the options are invalid.

  • Deletes a subject.

    This method can be used to send a DELETE message to a configured REST endpoint.

    Parameters

    • subject: string

      The subject to delete.

    • commandParameters: CommandParametersObject

      command parameters.

    • commandListener: CommandResultListener

      A listener that receives notification of the delete command's success or failure plus any return value.

    Returns CommandSubscription

    Information about the 'delete' command.

    Description

    The commandParameters argument takes the following JSON configuration attributes:

    Attribute name Type Default Optional Description
    payload object null Yes

    The payload associated with this command, the payload should be of the type specified by the payloadType attribute.

    payloadType PayloadType PayloadType.JSON Yes

    The type of the payload.

    headers [{header:"header1", value:"value1"}, {header:"header2", value:"value2"}, ...] Array of HTTP headers applied to the mapped REST enndpoint. Yes Applies HTTP headers to the REST endpoint, applies only to subjects mapped to REST endpoints in the Liberator.

    Function

  • Deletes a subject in the Liberator.

    Parameters

    • subject: string

      The name of the subject to delete.

    • commandListener: CommandListener

      A listener that is called to provide information about the result of the 'delete subject' command.

    Returns void

  • Instructs this StreamLink instance to disconnect from the Liberator.

    Returns void

  • Returns information about the state of the current connection.

    Returns ConnectionCurrentState

    object containing the current state of the connection, fields available are the latest values reported by the addConnectionListener callbacks.

  • Returns an array containing the last "log_buffer_size" log lines written by the current {StreamLink} instance. If log_buffer_size is not set or <= 0 then the log buffer is disabled and this method will always return an empty array

    Returns LogInfo[]

    An array containing the last "log_buffer_size" log lines written by this instance, or an empty array if "log_buffer_size" is not set

  • Returns the StreamLink logger object. You can receive StreamLink log messages by adding your own LogListener to this object.

    Returns Logger

    The StreamLink logger.

  • Gets the version of StreamLink JavaScript.

    Returns string

    String The version number and build identifier for this version of the StreamLink library.

  • Informs StreamLink the network connection is available so can connect.

    Returns void

  • Informs StreamLink the network connection is unavailable so it will not try to connect.

    Returns void

  • Pauses StreamLink so it does not receive new updates from the Liberator. The KeyMaster session will be kept alive.

    This method can be used as part of your applications lifecycle to conserve battery life and reduce data usage by not receiving data when your application is in the background.

    Returns void

  • Publishes data to a subject.

    This method can be used to send a PUT message to a configured REST endpoint.

    Parameters

    • subject: string

      The subject to publish to.

    • commandParameters: CommandParametersObject

      command parameters.

    • commandListener: CommandResultListener

      A listener that receives notification of the publish command's success or failure plus any return value.

    Returns CommandSubscription

    Information about the 'publish' command. If the commandParameters made the command persistent, you can subsequently cancel this by calling the CommandSubscription's unPersist() method.

    Description

    The commandParameters argument takes the following JSON configuration attributes:

    Attribute name Type Default Optional Description
    payload object null Yes

    The payload associated with this command, the payload should be of the type specified by the payloadType attribute.

    payloadType PayloadType PayloadType.JSON Yes

    The type of the payload.

    persistent boolean false Yes

    When true, if the connection to the Liberator fails after publication, the data is resent when StreamLink reconnects.

    When false, if the connection to the Liberator fails after publication, the data is not resent when StreamLink reconnects.

    cancellable boolean false Yes

    Sets the command associated with these parameters to be cancelled in the event that the connection goes down before it is sent.

    headers [{header:"header1", value:"value1"}, {header:"header2", value:"value2"}, ...] Array of HTTP headers applied to the mapped REST enndpoint. Yes Applies HTTP headers to the REST endpoint, applies only to subjects mapped to REST endpoints in the Liberator.

    Function

  • Publishes JSON data to a subject.

    Parameters

    • subject: string

      The subject to publish to.

    • jsonObject: any

      The JS object to publish as JSON.

    • commandListener: CommandListener

      A listener that receives notification of the publish command's success or failure.

    • Optional commandParameters: any

      Optional JSON configuration attributes.

    Returns CommandSubscription

    Information about the 'publish' command. If the commandParameters made the command persistent, you can subsequently cancel this by calling the CommandSubscription's unPersist() method.

    Description

    The commandParameters argument takes the following JSON configuration attributes:

    Attribute name Type Default Optional Description
    persistent boolean false Yes

    When true, if the connection to the Liberator fails after publication, the data is resent when StreamLink reconnects.

    When false, if the connection to the Liberator fails after publication, the data is not resent when StreamLink reconnects.

    cancellable boolean false Yes

    Sets the command associated with these parameters to be cancelled in the event that the connection goes down before it is sent.

    Function

  • Publishes data to a subject.

    Parameters

    • subject: string

      The subject to publish to.

    • fieldData: any

      The data, as key-value pairs, to be published to the subject.

    • commandListener: CommandListener

      A listener that receives notification of the publish command's success or failure.

    • Optional commandParameters: any

      Optional JSON configuration attributes.

    Returns CommandSubscription

    Information about the 'publish' command. If the commandParameters made the command persistent, you can subsequently cancel this by calling the CommandSubscription's unPersist() method.

    Description

    The commandParameters argument takes the following JSON configuration attributes:

    Attribute name Type Default Optional Description
    persistent boolean false Yes

    When true, if the connection to the Liberator fails after publication, the data is resent when StreamLink reconnects.

    When false, if the connection to the Liberator fails after publication, the data is not resent when StreamLink reconnects.

    cancellable boolean false Yes

    Sets the command associated with these parameters to be cancelled in the event that the connection goes down before it is sent.

    Function

  • Registers a provider of json data for the given subject pattern

    Parameters

    • pattern: string

      the subject glob pattern

    • provider: JsonProvider

      the provider that will be called when requests for subjects matching the given pattern are received.

    • Optional commandListener: CommandListener

      A listener that is called to provide information about the result of the registration.

    Returns JsonProviderHandle

    a JsonProviderHandle object.

  • Registers a provider of record data for the given subject pattern

    Parameters

    • pattern: string

      the subject glob pattern

    • provider: RecordProvider

      the provider that will be called when requests for subjects matching the given pattern are received.

    • Optional commandListener: CommandListener

      A listener that is called to provide information about the result of the registration.

    Returns RecordProviderHandle

    a RecordProviderHandle object.

  • Removes a previously added ConnectionListener from this StreamLink instance. After removal, no further callbacks are received by this ConnectionListener.

    Parameters

    Returns void

  • Re-establishes the connection to the Liberator to receive updates.

    This method can be used as part of your applications lifecycle to conserve battery life and reduce data usage by not receiving data when your application is in the background.

    Returns void

  • Requests a single update from a subject.

    Parameters

    • subject: string

      The subject to subscribe to.

    • subscriptionListener: SubscriptionListener

      A listener that is called to provide information about the result of the subscription request, the subscribed data, and subsequent updates to that data.

    • Optional subscriptionParameters: any

      Optional JSON configuration attributes.

    Returns void

    Description

    The subscriptionParameters argument takes the following JSON configuration attributes:

    Attribute name Type Default Optional Description
    structureonly boolean false Yes If this value is set, the subscription will not provide field data updates
    keepinaccessible boolean false Yes If this value is set, the container will keep elements that are unavailable.
    fields [string] All fields are subscribed to. Yes An array of the the fields to subscribe to.

    For example: ["field_a","field_b","field_d"]

    filter {value: string, image: boolean} No filter is applied. Yes A filter that restricts the number of field updates that will be received.

    The value string specifies the filter criteria. For example: (dLast >50) & (dVolumeAcc > 1000)/code>, means that the Liberator sends updates only when the value of the field dLast is greater than 50 and the dVolumeAcc field is greater than 1000.

    When the image boolean is true, the filter not applied until after the data within a particular update has been applied to the image of the data item. When image is false, the update filter is applied just to the data within a particular update of the data item.

    For more information about filters, see the 'Filtering data' section of the document StreamLink Overview.

    window {start: int, size: int} Updates are returned for the whole container (subject to any filter applied). Yes When the subscription is to a container, this attribute defines a window that begins at the element defined by start, and is size elements long. Liberator only returns updates for the elements that are in the window. The first element in a container starts at position 0 (zero).
    select {where: string, orderby: string, groupby: string} Updates are returned for the whole container in creation order. Yes When the subscription is to a container and the backend system is running Caplin Refiner, this attribute defines the selection and sorting applied to the container.

    Parameters:

    where: The where clause, in the form accepted by Caplin Refiner (example bid>123&ask<222). Use the ContainerFilterFactory to help build valid where clauses.

    orderby: The sorting order of the returned container in the form: field [ASC|DESC] [NUMBER|TEXT], ... example: bid DESC NUMBER,ask ASC NUMBER

    groupby: The group by clause in the form: field example: bid

    freeform [string] Free form string parameters. Yes Freeform subscription parameters allows you to pass parameters to subscriptions for subject types that are not records or containers. They can be used to define filter expressions for filtering news headlines. For more information about news headlines, and the syntax and rules for defining news filter expressions, see the "News filtering" section of the StreamLink Overview
    json [string] jsonpath filter string parameter. Yes Sets the filter that restricts the the information returned by the subscription. The filtering is performed by the Liberator, rather than the client, so that bandwidth and client side processing are reduced.

    For more details on the format of the filter string, please see https://goessner.net/articles/JsonPath/.

    headers [{header:"header1", value:"value1"}, {header:"header2", value:"value2"}, ...] Array of HTTP headers applied to the mapped REST enndpoint. Yes Applies HTTP headers to the REST endpoint, applies only to subjects mapped to REST endpoints in the Liberator.

    Function

  • Subscribes to a subject to receive updates.

    Parameters

    • subject: string

      The subject to subscribe to.

    • subscriptionListener: SubscriptionListener

      A listener that is called to provide information about the result of the subscription request, the subscribed data, and subsequent updates to that data.

    • Optional subscriptionParameters: any

      Optional JSON configuration attributes.

    Returns Subscription | ViewSubscription

    Information about the subscription. You can unsubscribe (stop receiving updates) from a subscription using the unsubscribe() method on the returned Subscription object.

    Description

    The subscriptionParameters argument takes the following JSON configuration attributes:

    Attribute name Type Default Optional Description
    fields [string] All fields are subscribed to. Yes An array of the the fields to subscribe to.

    For example: ["field_a","field_b","field_d"]

    filter {value: string, image: boolean} No filter is applied. Yes A filter that restricts the number of field updates that will be received.

    The value string specifies the filter criteria. For example: (dLast >50) & (dVolumeAcc > 1000)/code>, means that the Liberator sends updates only when the value of the field dLast is greater than 50 and the dVolumeAcc field is greater than 1000.

    When the image boolean is true, the filter not applied until after the data within a particular update has been applied to the image of the data item. When image is false, the update filter is applied just to the data within a particular update of the data item.

    For more information about filters, see the 'Filtering data' section of the document StreamLink Overview.

    window {start: int, size: int} Updates are returned for the whole container (subject to any filter applied). Yes When the subscription is to a container, this attribute defines a window that begins at the element defined by start, and is size elements long. Liberator only returns updates for the elements that are in the window. The first element in a container starts at position 0 (zero).
    freeform [string] Free form string parameters. Yes Freeform subscription parameters allows you to pass parameters to subscriptions for subject types that are not records or containers. They can be used to define filter expressions for filtering news headlines. For more information about news headlines, and the syntax and rules for defining news filter expressions, see the "News filtering" section of the StreamLink Overview
    json [string] jsonpath filter string parameter. Yes Sets the filter that restricts the the information returned by the subscription. The filtering is performed by the Liberator, rather than the client, so that bandwidth and client side processing are reduced.

    For more details on the format of the filter string, please see https://goessner.net/articles/JsonPath/.

    headers [{header:"header1", value:"value1"}, {header:"header2", value:"value2"}, ...] Array of HTTP headers applied to the mapped REST enndpoint. Yes Applies HTTP headers to the REST endpoint, applies only to subjects mapped to REST endpoints in the Liberator.
    select {where: string, orderby: string, groupby: string} Updates are returned for the whole container in creation order. Yes When the subscription is to a container and the backend system is running Caplin Refiner, this attribute defines the selection and sorting applied to the container.

    Parameters:

    where: The where clause, in the form accepted by Caplin Refiner (example bid>123&ask<222).
    Use the ContainerFilterFactory to build valid where clauses (see example below).

    orderby: The sorting order of the returned container in the form: field [ASC|DESC] [NUMBER|TEXT], ... example: bid DESC NUMBER,ask ASC NUMBER

    groupby: The group by clause in the form: field [,field] example: bid,ask

    Container filtering example using the ContainerFilterFactory to build the where clause:

    
     // Build an expression for FIELD1 > 0.1 AND FIELD3 = "a a"
     var exp1 = ContainerFilterFactory
       .create("FIELD1", FilterExpressionOperator.GREATER_THAN, "0.1");
     var exp2 = ContainerFilterFactory
       .create("FIELD3", FilterExpressionOperator.EQUAL, "a a");
     var exp1Andexp2 = ContainerFilterFactory
       .createLogical(FilterExpressionLogicalOperator.AND, exp1, exp2);
    
    

    var subscription = streamLink.subscribe("/container", subscriptionListener, {"select": { "where": exp1Andexp2.toFilterString(), "orderby": "FIELD1" } });

    Note: if you subscribe to a container multiple times, then include one or both of the configuration attributes window and select in each subscription to the container. The presence of either of these attributes indicates to StreamLink that the subject is a container, and causes StreamLink to add a sequential container-instance identifier to the subscription request. Liberator uses this identifier to support multiple subscriptions to the same container; without this identifier, only the first subscription to a container will have a container instance and receive updates. If you don't want to window or filter a container, then specify a window with a large size, for example window:{start:0, size:999999999}.

    Function

  • Throttles all the currently subscribed subjects, reducing the number of updates that are sent every second.

    For a fuller explanation of throttling, refer to the 'Throttling' section of the document StreamLink Overview.

    Parameters

    • throttleCommand: ThrottleCommand

      The throttle command to apply.

    • commandListener: CommandListener

      A listener that is called to provide information about the result of the throttle command.

    • Optional commandParameters: any

      Optional JSON configuration attributes; for details, see the commandParameters parameter of throttleSubject().

    Returns CommandSubscription

    Information about the 'throttle' command. If the commandParameters made the command persistent, you can subsequently cancel this by calling the CommandSubscription's unPersist() method.

  • Throttles the specified subject, reducing the number of updates that are sent every second.

    For a fuller explanation of throttling, refer to the 'Throttling' section of the document StreamLink Overview.

    Parameters

    • subject: string

      The subject for which received data updates are to be throttled.

    • throttleCommand: ThrottleCommand

      The Throttle command to apply.

    • commandListener: CommandListener

      A listener that is called to provide information about the result of the throttle command.

    • Optional commandParameters: any

      Optional JSON configuration attributes.

    Returns CommandSubscription

    Information about the 'throttle' command. If the commandParameters made the command persistent, you can subsequently cancel this by calling the CommandSubscription's unPersist() method.

    Description

    The commandParameters argument takes the following JSON configuration attributes:

    Attribute name Type Default Optional Description
    persistent boolean false Yes

    When true, the throttle setting for this command persists across a failure of the connection to Liberator and subsequent reconnection.

    When false, the throttle setting only applies to the current Liberator session and does not persist following a connection failure.

    For a fuller explanation, see the 'Persistence' section of the StreamLink Overview document.

    cancellable boolean false Yes

    Sets the command associated with these parameters to be cancelled in the event that the connection goes down before it is sent.

Generated using TypeDoc