Identifier for a specific WebSocket topic.
WebSocket subscriber object or subscriber key.
WebSocket alias, otherwise the default alias is used.
Basic
const mySubscriber = await ix.websocket.subscribeToTopic("<TOPIC-IDENTIFIER>", {
onmessage: (data) => {
console.log(data);
}
});
Advanced
const mySubscriber = await ix.websocket.subscribeToTopic("<TOPIC-IDENTIFIER>", {
key: "key1",
onmessageJSON: (data) => {
console.log(data);
},
onerror: (error) => {
console.log(error);
},
onclose: (event) => {
console.log(event);
}
});
Subscribe for WebSocket messages with a specific topic key.