For AI agents: this page in Markdown: https://www.pubnub.com/docs/sdks/javascript.md. Documentation index: https://www.pubnub.com/llms-full.txt.
JavaScript SDK 13.1.3
Real-time messaging, presence, and storage in browsers, Node.js, React, and React Native.
npm install pubnub
What do you want to do?
Show who is online
Secure access with tokens
- Configure access controlEnable Access Manager on your keyset.
- Initialize a server SDK with a secret keySet up the server that issues tokens.
- Initialize a client SDK with an auth keyGive a client its token at startup.
- Grant, change, and revoke permissionsIssue, update, and revoke tokens.
- Update an expired tokenRecover a client after a 403 error.
API reference
Publish
Send messages and signals.
Subscribe
Listen for messages and events.
Configuration
Initialize the client and set options.
Access Manager
Tokens and permissions.
Presence
Online status, occupancy, and state.
Message Persistence
Fetch, count, and delete history.
DataSync
Entities, queries, and events.
File Sharing
Upload, download, and list files.
Channel Groups
Subscribe to many channels at once.
Message Actions
Reactions and receipts.
Mobile Push
Push notifications for mobile apps.
Encryption
Encrypt files and part of a message.
Miscellaneous
Utility methods.
Work with the SDK
Set up your environment
Install the SDK and set up TypeScript.
Choose your runtime
Web, Node.js, React, or React Native.
Status events
Connection and error categories.
Logging
Turn on and read SDK logs.
Platform support
Supported browsers and runtimes.
Feature support
What each SDK version supports.
Changelog
Release notes for every version.
FAQ
Common questions about the SDK.