I am currently working on setting up a live data streaming feature using Kafka for our company's website. My goal is to have a real-time updating plot displayed on the site.
With the help of the kafkaJS documentation, I was able to create a functional JS consumer.
Now, my next step is to incorporate this script into an HTML file on our website in order to continuously read incoming data and generate the plot.
var source = new EventSource('script.js');
source.addEventListener('message', function(e){
console.log('Message')
obj = JSON.parse(e.data);
console.log(obj);
})
Unfortunately, when testing this setup on my site, I encountered the following error:
EventSource's response has a MIME type ("application/javascript") that is not "text/event-stream". Aborting the connection.
I'm uncertain if I'm moving in the right direction with this approach or if it's even achievable given my limited experience in this area. Finding helpful resources has been challenging for me.
Any assistance or guidance you can provide would be immensely valuable.
Thank you very much.