DEV Community

Discussion on: Kafka + WebSockets + Angular: event-driven microservices all the way to the frontend

Collapse
 
marianixon profile image
marianixon

Is there any way to send messages directly from KTable to websocket?

I have data that are constantly updating. I keep them in Kafka compacted topic. When new websocket customer arrive I would like to send him a current state of my data, and then I want to send him automatically every change of the data. I believe that the best way it would be to somehow bind KTable (or GlobalKTable, or some state store maybe) with websocket. Is something like that possible?

Collapse
 
victorgil profile image
Víctor Gil • Edited

Hi, sorry for the late response.
Well, since a KTable is basically (please allow me the rough simplification) a view based on a Kafka topic, I guess what you are really asking is whether out-of-the-box integration with Kafka using Websockets exists.
And unfortunately the answer is no, it does not exist.
As per this post, it looks like they experimented with the idea at Confluent, but I could not find anything more about websockets in their blog nor documentation.
I also found this (random) repository on Github but it is 5 years old and looks abandoned.
I even considered to try building a Kafka connector for Websockets myself but I never started it.