Cumulocity Web SDK - v1021.62.8
    Preparing search index...

    Class Realtime

    Index

    Constructors

    • Allows to set up a realtime (websocket or long-polling) connection to the platform.

      Parameters

      • client: IFetchClient

        The fetch client instance to use

      • url: string = '/notification/realtime'

        The URL to connect to

      • OptionalhandshakeCallback: (msg: HandshakeMessage) => void

        A function which is called on succeeded or failed handshake

      Returns Realtime

    Methods

    • Allows to listen to Cometd connection to e.g. detect when connection was lost.

      Parameters

      • callback: (msg: Message) => void

      Returns SubscriptionHandle

    • Allows to listen to Cometd handshake to find out if e.g. the connection was reestablished.

      Parameters

      • callback: (msg: HandshakeMessage) => void

      Returns SubscriptionHandle

    • Removes the subscription obtained with a call to addHandshakeListener or addConnectListener.

      Parameters

      • subscriptionHandle: SubscriptionHandle

      Returns void

    • Resubscribes as necessary in case of a re-handshake.

      Parameters

      • subscriptionHandle: SubscriptionHandle

      Returns SubscriptionHandle

    • Subscribes to a realtime channel to listen for data.

      Parameters

      • channel: string

        The channel to connect to

      • callback: Callback

        A function to call when data is received

      Returns SubscriptionHandle

    • Cancels the listening to a channel.

      Parameters

      • subscription: SubscriptionHandle

        The subscription object returned by subscribe()

      Returns void