interface EventsChannel {
    close(): void;
    subscribe(observer, subOptions?): Subscription;
}

Methods

  • Experimental

    API may change in future versions

    Close channel and any active subscriptions

    Returns void

    Example

    const channel = await events.connect("default/channel")

    channel.close()
  • Experimental

    API may change in future versions

    Subscribe to Events

    Parameters

    Returns Subscription

    Example

    const channel = await events.connect("default/channel")

    channel.subscribe({
    next: (data) => { console.log(data) },
    error: (err) => { console.error(err) },
    })

    Example

    // authMode override
    channel.subscribe({
    next: (data) => { console.log(data) },
    error: (err) => { console.error(err) },
    }, { authMode: 'userPool' })