ZPusher Client (v1.0.9) is a WebSocket client library for connecting to ZPusher servers. It provides an event-driven API with automatic reconnection, channel subscription, and promise-based connection management. The library ships as a single JavaScript file supporting both Node.js and browser environments via script tag or npm. Key features include configurable auto-connect, reconnect timeout, and support for custom event listeners (open, close, error, reconnect). The package has no additional dependencies but requires a valid token and WebSocket endpoint. Compared to alternatives like Socket.IO, ZPusher is minimal and focused specifically on ZPusher server protocol.
npm install zpusher-clientNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initializes ZPusher with endpoint and token, connects, subscribes to a channel, and listens for events.
Always chain onEvent within the subscribe()'s .then() callback, not before.
Implement custom token refresh logic by listening to the 'close' event and re-initializing with a new token.
Use a polyfill or ensure modern browser support.
Rely on current implementation but be prepared for changes. Monitor release notes.
Ensure you include <script src='./node_modules/zpusher-client/dist/zpusher.js'></script> before using ZPusher.
Always call subscribe() inside the pusher.on('open', ...) callback.Use onEvent only inside the .then() callback of subscribe().
No dependency data recorded yet.