- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Registering WebSocket connections with NiFi
- Labels:
-
Apache NiFi
Created 01-11-2017 12:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I’m working with NiFi WebSocket processors, and I’d like to update connected clients as data makes its way through the flow. Is there a way to register WS connections in such a way where once data makes its way to a PutWebSocket processor, I can push to all registered clients automatically?
Is this outside the scope of what NiFi may have been intended for?
Thanks!
Created 01-11-2017 01:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Edgar,
Currently, PutWebSocket processor needs an incoming flow file having a WebSocket session id attribute to tell the NiFi WebSocket server which connected client to send a message to.
I have tested a flow explained in this Gist to pull messages from Kafka then send it back to multiple connected clients.
https://gist.github.com/ijokarumawak/60b9ab2038ef906731ebf4c0eee97176
The flow does work, but it keeps flow files floating around in the loop and basically too difficult to setup.
The list of connected session ids are kept in WebSocket server controller service, so, theoretically it's possible to loop through those sessions in controller service without passing a specific session id from PutWebSocket processor. Maybe we can improve PutWebSocket processor so that it can send messages to every connected client.
I will create a JIRA for this improvement, in the meanwhile, please use the workaround like the above example flow.
Thanks!
Created 01-11-2017 01:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Edgar,
Currently, PutWebSocket processor needs an incoming flow file having a WebSocket session id attribute to tell the NiFi WebSocket server which connected client to send a message to.
I have tested a flow explained in this Gist to pull messages from Kafka then send it back to multiple connected clients.
https://gist.github.com/ijokarumawak/60b9ab2038ef906731ebf4c0eee97176
The flow does work, but it keeps flow files floating around in the loop and basically too difficult to setup.
The list of connected session ids are kept in WebSocket server controller service, so, theoretically it's possible to loop through those sessions in controller service without passing a specific session id from PutWebSocket processor. Maybe we can improve PutWebSocket processor so that it can send messages to every connected client.
I will create a JIRA for this improvement, in the meanwhile, please use the workaround like the above example flow.
Thanks!
Created 01-11-2017 01:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ah, gotcha. Will use that workaround - thanks!
Created 01-11-2017 01:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A JIRA is created
Created 01-11-2017 01:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if they are connected to the websocket you can send them information from the flow.
You could also package that information into KAFKA or JMS and send them to a queue and a backend will pull from the queue and send the WebSocket messages. That is probably more common to connect to the front end web.
