Experimental
API may change in future versions
Subscribe to Events
observer callback handlers
{ next: () => {}, error: () => {}}
Optional
subOptions: EventsOptionsconst channel = await events.connect("default/channel")
channel.subscribe({
next: (data) => { console.log(data) },
error: (err) => { console.error(err) },
})
// authMode override
channel.subscribe({
next: (data) => { console.log(data) },
error: (err) => { console.error(err) },
}, { authMode: 'userPool' })
API may change in future versions
Close channel and any active subscriptions