You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@nifi.apache.org by Valentina Ivanova <va...@ri.se> on 2020/05/01 09:55:27 UTC

Working with Web Sockets

Hello!

I am making first steps with working with web sockets in nifi. I have to connect to a web socket, subscribe to a topic, and then regularly send heartbeat messages. With this configuration I have to receive text messages twice per second. My flow is attached. The UpdateAttributes processors are used to set values for some attributes which are then turned into JSON by the AttributesTOJSON processors.
The top pair of UpdateAttributes  and AttributesTOJSON  is used for subscribing to a topic and the bottom pair for the heartbeats. The PutWebSocket is scheduled every 25 sec. as per the server requirement.

With this set up, however, I am only able to subscribe to the topic - receive confirm message - and receive one message with the given topic. Then I start receiving messages every 25 sec which are replies to my heartbeat messages and not the expected messages twice per second. I guess I might be doing something wrong when sending the heartbeats but cannot figure out what.

Is this the correct way to send heartbeats? Has anyone seen similar behaviour and how to resolve it?

Many thanks & all the best

Valentina