Client is an interface for a generic subscription client.

Hierarchy

  • Client

Indexable

[key: string]: any

Methods

  • Channel returns the client's communication channel.

    Returns undefined

  • Discard marks the client as "discarded", meaning that it shouldn't be used anymore for sending new messages.

    It is safe to call Discard() multiple times.

    Returns void

  • Get retrieves the key value from the client's context.

    Parameters

    • key: string

    Returns any

  • HasSubscription checks if the client is subscribed to sub.

    Parameters

    • sub: string

    Returns boolean

  • Id Returns the unique id of the client.

    Returns string

  • IsDiscarded indicates whether the client has been "discarded" and should no longer be used.

    Returns boolean

  • Set stores any value to the client's context.

    Parameters

    • key: string
    • value: any

    Returns void

  • Subscribe subscribes the client to the provided subscriptions list.

    Each subscription can also have "options" (json serialized SubscriptionOptions) as query parameter.

    Example:

     Subscribe(
    "subscriptionA",
    `subscriptionB?options={"query":{"a":1},"headers":{"x_token":"abc"}}`,
    )

    Parameters

    • Rest ...subs: string[]

    Returns void

  • Subscriptions returns a shallow copy of the client subscriptions matching the prefixes. If no prefix is specified, returns all subscriptions.

    Parameters

    • Rest ...prefixes: string[]

    Returns _TygojaDict

  • Unset removes a single value from the client's context.

    Parameters

    • key: string

    Returns void

  • Unsubscribe unsubscribes the client from the provided subscriptions list.

    Parameters

    • Rest ...subs: string[]

    Returns void

Generated using TypeDoc