import StreamEvents from '@wowzamediasystems/sdk-rts'
//Create a new instance
const streamEvents = await StreamEvents.init()
const accountId = "Publisher account ID"
const streamName = "Stream Name"
const options = {
accountId,
streamName,
callback: (data) => {
if (data.error) {
console.error("Handle error: ", error)
} else {
console.log("Viewers: ", data.count)
}
}
}
//Initializes the user count event
streamEvents.onUserCount(options)