What product/components do you use and which version/fix level are you on?
Question related to receiving real-time measurements with Cumulocity IoT.
Is your question related to the free trial, or to a production (customer) instance?
I am using free trial tenant.
What are you trying to achieve? Please describe it in detail.
I am trying to get real-time measurements using “notification2” websocket.
All looks good for first time after establishing data channel but after 1-2 minutes websocket stops receiving new data and I need to restart websocket to continue getting measurements updates.
Already tried few different websockets from Node-Red, NodeJS, and Postman but behaviour the same.
Steps to reproduce:
Ensure subscription created and if not create one:
Make POST request to https://<tenant_id>.eu-latest.cumulocity.com/notification2/subscriptions with following body:
Use token from response of previous request to make websocket connection: wss://<tenant_id>.eu-latest.cumulocity.com/notification2/consumer/?token=<new_token>
Result:
Receiving data for 1-2 mins and after that steam stucks without any errors (websocket connection looks good)
I have a similar issue. I received only 1000 measurements through websocket and didn’t receive new ones. Does anybody know why only 1000 measurements were received in websocket and all new ones were ignored?
Hi guys. I tried notification2 with Websocket to get measurements and managedObjects. It works well and gets all the data. The duration of the connection and the amount of data don’t have any effect of the data reception in my case. Here are my steps:
Create a subscription: send post request to “https://<tenant_id>.eu-latest.cumulocity.com/notification2/subscriptions”. Context is mo, apis has “measurements” and “managedObjects”.
Create a token: send post request to “https://<tenant_id>.eu-latest.cumulocity.com/notification2/token”. Payload of it has “subscription”," subscriber" and “expiresInMinutes”.
Build the Websocket connection using Python package “websocket”.
After 10 mins I can still get the data of measurements and managedObjects. After 1000 measurements it can still receive new measurements.
The WebSocket service sends a sequence of notifications to the consumer and the consumer should send back a short acknowledgement over this connection for each notification received.
Hence without the acknowledgements the server might close the connection.
I suspect Kai is correct here. The default internal queue size for unacknowledged notifications is 1,000 - once that queue is full no further messages will be delivered to the consumer until some of the pending ones have been acknowledged.