The pub/sub topic interface.

interface IPubSubTopic<T> {
    subscribe: SubscribeFunction<T>;
    close(): void;
    getName(): string;
    getOwnerId(): string;
    publish(content: File | T, nodeIds?: string[]): void;
    unsubscribe(contentType: keyof ISubscriptions<T>): void;
}

Type Parameters

  • T

Hierarchy (view full)

Properties

subscribe: SubscribeFunction<T>

Subscribe to the topic.

Any of the content types defined in ISubscriptions.

One of the content type defined in ISubscriptions.

The callback when the content is received. callbacks' payload are defined in ISubscriptions.

Methods

  • Close the topic.

    Returns void

  • Publish content to the topic.

    Parameters

    • content: File | T

      The content to publish. Content needs to be a valid JSON.stringify argument.

    • OptionalnodeIds: string[]

      The node IDs to publish to.

    Returns void

  • Unsubscribe from the topic.

    Parameters

    Returns void