Build real-time applications with PubNub pub/sub messaging
Does it follow best practices?
Evaluation — 88%
↑ 1.28xAgent success when using this tile
Validation for skill structure
A SaaS company is building a browser-based customer support dashboard where support agents connect to real-time channels to receive incoming customer tickets. Each support agent logs in with their company credentials and needs to maintain a persistent connection to PubNub throughout their shift. The engineering team has noticed that every time an agent refreshes their browser tab, they appear as a new user in the PubNub presence system, which inflates their monthly active user (MAU) counts and causes confusion in presence tracking.
The team needs a JavaScript module that properly initializes the PubNub SDK for browser-based support agents. The module should handle the case where agents may reload their page multiple times during a shift but should always be recognized as the same user. The module should also expose a method to connect to a given support queue channel and begin receiving messages.
Produce a single JavaScript file named support-agent-client.js that exports:
The code should be production-ready for a browser environment.