Namespace: ix.websocket

ix.websocket

Websocket API - Provides a handful of methods to receive messages for all or specific topics via the standard intrexx websocket.

Methods


ix.websocket.subscribeToTopic(topic, subscriber [, websocketAlias])

Subscribe for websocket messages with a specific topic key.

Parameters:
Name Type Argument Description
topic String

Identifier for a specitfic websocket topic.

subscriber ix.websocket~WebSocketSubscriberInfo
websocketAlias String <optional>

Websocket alias otherwise the default intrexx websocket is used.

Returns:

UpWebSocketSubscriber

Type
Promise.<UpWebSocketSubscriber>
Examples
const mySubscriber = await ix.websocket.subscribeToTopic("D00F000000000000000000000000000000000000", {
   onmessage: (data) => {
      console.log(data);
   }
});
const mySubscriber = await ix.websocket.subscribeToTopic("D00F000000000000000000000000000000000000", {
   key: "key1",
   onmessageJSON: (data) => {
      console.log(data);
   },
   onerror: (error) => {
      console.log(error);
   },
   onclose: (event) => {
      console.log(event);
   }
});

ix.websocket.unsubscribeFromTopic(subscriber [, websocketAlias])

Unsubscribe for websocket messages.

Parameters:
Name Type Argument Description
subscriber string | UpWebSocketSubscriber

WebSocket subscriber object or subsriber key.

websocketAlias String <optional>

Websocket alias otherwise the default intrexx websocket is used.

Examples
ix.websocket.unsubscribeFromTopic(mySubscriber)
ix.websocket.unsubscribeFromTopic("key1")