Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Updater

An updater provides methods to update a topic on the server with a new supplied value, like TopicControl.update, but within the context of an exclusive TopicUpdateHandler registration. If the update is successful it will call the result's success callback, and any sessions subscribed to the same topic will be notified of a topic update.

An updater may only update topics at or below the registration path of the TopicUpdateHandler from which it was produced.

The result will fail if the update was not successful. It is necessary for the topic to exist, and that the value type must be valid for the topic, for example a topic added with TopicTypeEnum.INT64 cannot accept a string value. Updates will also fail if the TopicUpdateHandler this updater was created from is in a standby or closed state.

Example:

updater.update('foo/bar', 123).then(function() {
    // Update successful
}, function(err) {
    // Update failed
});
deprecated

since 6.2

This class is deprecated. It is only used in conjunction with TopicControl.registerUpdateSource. Use TopicUpdate.createUpdateStream instead. This method will be removed in a future release.

Hierarchy

  • Updater

Index

Methods

update

  • update(path: string, value: any): Result<void>
  • Update a topic

    Prefer updateValue when updating a Double or Int64 topic. This method can infer the wrong data type when updating a Double topic with a value that does not have a fractional component.

    Parameters

    • path: string

      the topic to update

    • value: any

      the value to update the topic with

    Returns Result<void>

    the Result that completes when the update succeeded

updateValue

  • updateValue(path: string, value: any, datatype: DataType<any, any, any>): Result<void>
  • Update a topic with a specified data type

    Parameters

    • path: string

      the topic to update

    • value: any

      the value to update the topic with

    • datatype: DataType<any, any, any>

      the data type to be used for encoding the value

    Returns Result<void>

    the Result that completes when the update suceeded