1.3.2 Subscribing For Messages

To receive data over the websocket, the data must be subscribed for. With the sat-nms Software, each device parameter and each type/range description has its unique message ID. For each message ID an explicit subscription must be done to get this parameter and its updates. The /api/v1/subscribe API call does this, either for a single message ID or for a list of IDs. Subscriptions are made for a certain websocket instance, hence the ID of the websocket must be supplied with the subscribe call.

Subscribed messages are sent asynchronously, each time when a change of the parameter is detected. It is not guaranteed, that a subscribe results immediately in a message sent over the websocket. Parameters may be in the state "unknown", specially in the first minutes after starting a M&C. Such a parameter will be sent when the first value becomes available.

The /api/v1/subscribe API call is also is used to unsubscribe messages using the DELETE HTTP method. It is recommended to unsubscribe messages for which there are no more updates needed.

Closing the websocket automatically unsubscribes all pending subscriptions. There is no need to do this explicitly before closing the session.