PubNub is a service that specializes in low-latency messaging across any device or platform anywhere. With the incredible number of SDKs they provide, it really is possible to add their services to anything.
PubNub operates using “channels” on which a device can publish messages and subscribe to messages. Tons of applications can use this model, from messaging services to transportation management – but what if you want to visualize message rate trends?
That’s where Initial State comes in. Real-time dashboards to visualize data flowing through PubNub channels. You can use Initial State to see historical data as well.
I put together a stream using data from one of PubNub’s demo channels in less than an hour using their Python examples, but this should theoretically work with any language/platform using the Initial State API.
You do not need a PubNub account to try this out, but you will need an Initial State one. You will also need to install the PubNub and Initial State python libraries.
pip install pubnub>=3.7.6
pip install ISStreamer
The first channel I subscribed to was PubNub’s simulated Market Orders demo. Below is an animation of what the data looked like as it ticked in.
To replicate this, just run the code below, being sure to put your Initial State Access Key on line 33.
That was easy! But that data was simulated, so let’s test out a stream that’s immediately interesting – PubNub’s State Capital Weather demo. This is a pretty neat channel because you can see the temperature and weather conditions in any given state capital at a glance.
(This dashboard is interactive! Scroll down to see the weather conditions in the city closest to you and play with the timeline!)
To try this example out, just run the code below (again remembering to add your Access Key on line 33):