Class AirshipMessagingService

The Messaging Service provides Publish/Subscribe functionality for communicating across different game servers.

Methods

  • Publishes data to a topic, allowing other subscribers to receive the message.

    Parameters

    • topic: string

      The topic to publish to.

    • data: unknown

      The data to be sent

    Returns Promise<{
        success: boolean;
    }>

    A boolean indicating whether the publish was successful.

  • Subscribes to a topic, allowing you to receive messages published to that topic.

    Type Parameters

    • T = unknown

    Parameters

    • topic: string

      The topic to subscribe to.

    • callback: ((data) => void)

      The function that will be called when a message is received on the subscribed topic.

        • (data): void
        • Parameters

          • data: T

          Returns void

    Returns {
        unsubscribe: (() => void);
    }

    An object containing an unsubscribe function.

    • unsubscribe: (() => void)
        • (): void
        • Returns void