问题
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