Best way to display dynamic data in a webpage

你离开我真会死。 提交于 2019-12-11 08:06:30

问题


My goal is to visualize the incoming data stream on a browser. I have used activemq to queue the stream. A single message consumed from the queue looks like this: "int,date/time,int,string". I have to update my line graph on the browser (every 100ms). Any ideas?


回答1:


It sounds like a use case for WebSocket.

There are many ways to implement it, but a rather nice blog post on the topic is presented here.

Another way is to use MQTT directly from the browser using javascript and subscribe to a topic with your updates. You have to forward your data to that topic, in this case. For that, you can use composite queues with forwardOnly=false.




回答2:


If you're using ActiveMQ, you could enable its websockets interface: http://activemq.apache.org/websockets.html

In your browser code, use the STOMP over WebSocket library to subscribe to the queue. http://jmesnil.net/stomp-websocket/doc/



来源:https://stackoverflow.com/questions/23654715/best-way-to-display-dynamic-data-in-a-webpage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!