Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PendingSetStream

An update stream delegate that is used when a set operation is called on a new stream. The server has not yet responded to the initial set operation.

Hierarchy

  • PendingSetStream

Implements

Index

Constructors

constructor

  • Create a new PendingSetStream instance

    Parameters

    • streamServices: StreamServices

      the stream services

    • options: UpdateStreamOptions

      the update stream options

    • stream: UpdateStreamImpl

      the stream that using this stream as a delegate

    • pendingResult: Promise<any>

      the pending result

    • value: any

      the value of the pending set operation

    Returns PendingSetStream

Properties

Private Readonly deferredResolvers

deferredResolvers: DeferredResolution[]

Any deferred emitters that should be emitted once the pending result completes

Private nextValue

nextValue: any

The cached value of any subsequent set operations

Private Readonly options

The update stream options

Private Readonly pendingResult

pendingResult: Promise<any>

The pending result

Private Readonly stream

The stream that wrapped around this stream and using is as a delegate

Private Readonly streamServices

streamServices: StreamServices

The stream services

Private Readonly value

value: any

The value of the pending set operation

Methods

get

  • get(): any
  • Return the latest value of the topic set using this update stream.

    The returned value reflects the last value that has been set, before it is sent to the server.

    If the server rejects a set operation, the topic value will not change and this update stream will be invalidated.

    This method will throw an Error if called before the first call to set

    Returns any

    the cached value of the topic

onSetComplete

  • onSetComplete(streamId: UpdateStreamId, retainsValue: boolean, supportsConflation: boolean): void
  • Called when a set operation completes

    Parameters

    • streamId: UpdateStreamId

      the stream ID

    • retainsValue: boolean
    • supportsConflation: boolean

    Returns void

onSetFailed

  • onSetFailed(err: Error): void
  • Called when a set operation fails

    Parameters

    Returns void

onValidateComplete

  • onValidateComplete(): void
  • inheritdoc

    Returns void

onValidateFailed

  • onValidateFailed(): void
  • inheritdoc

    Returns void

Private processPendingUpdatesDoesntRetainValue

  • processPendingUpdatesDoesntRetainValue(streamId: UpdateStreamId): void
  • Parameters

    Returns void

Private processPendingUpdatesRetainsValue

  • Parameters

    Returns void

set

  • set(value: any): Promise<void>
  • Sets the topic to a specified value.

    null or undefined can only be passed to the value parameter when updating string, int64 or double topics.

    When a topic of type string, int64 or double is set to null or undefined , the topic will be updated to have no value. If a previous value was present subscribers will receive a notification that the new value is undefined . New subscribers will not receive a value notification.

    If this method fails once, all subsequent calls to UpdateStream.set or UpdateStream.validate will also fail.

    Parameters

    • value: any

      the value. Update streams for string, int64, and double topics accept null or undefined, as described above. Using null with other topic types is an error and will result in an Error .

    Returns Promise<void>

    a Promise that completes when a response is received from the server.

    The first set operation will return a TopicCreationResult indicating whether a new topic was created or it already exists.

    If the task fails, the Promise will resolve with an Error .

validate

  • Validates the update stream.

    Update streams are validated lazily when setting the value. This method allows the stream to be validated before a value needs to be set.

    If the update stream has not been validated yet, calling this method checks the topic exists, the topic type is correct, the constraint is satisfied and the session has permission to update the topic. Once it has been validated calling this method checks the topic has not been removed, no other stream has been created for the topic, the value of the topic has not been changed by anything else and the session still has permission to update the topic. If validation fails, the Promise will resolve with an Error.

    If this method fails all subsequent calls to set or validate will resolve with an Error.

    Returns Promise<TopicCreationResult>

    a Promise that completes when a response is received from the server.

Copyright © 2025 DiffusionData Ltd. All Rights Reserved.