Build real-time applications with PubNub pub/sub messaging
Agent Success
Agent success rate when using this tile
94%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.29x
Baseline
Agent success rate without this tile
73%
You are building an IoT monitoring dashboard that receives real-time sensor data via PubNub. The system monitors a campus with multiple buildings, each having multiple floors, and each floor having various sensor types (temperature, humidity, motion). A facility manager needs to subscribe to different scopes of data: all sensors across campus, all sensors in a building, or all sensors on a specific floor.
Write a JavaScript module (sensor-subscriptions.js) that:
Assume a PubNub instance is passed into each function.
sensor-subscriptions.js file with the channel naming scheme and subscription helper functions for each scope level.