subscribe()
Last updated
Last updated
await ws.subscribe('chat.message.received', function (eventData) { console.log('Received new chat message!', eventData); });
try {
let res = await ws.subscribe('some.another.topic',
function (eventData) { console.log('Received topic event', eventData); }
);
console.log('Successfully subscribed to topic: ' + res.topic);
} catch (e) {
console.log('Subscription error:' + e.error);
}