Introduction
Brook is a real-time fault-tolerant pub/sub SDK for JavaScript, Go, and React applications. It provides WebSocket connectivity with automatic reconnection, message replay for missed messages, and seamless integration with your favorite frameworks.Features
- Real-time messaging with WebSocket
- Automatic reconnection with exponential backoff
- Message replay for missed messages
- React hooks for seamless integration
- Lightweight and performant
- Full TypeScript support
Installation
Package Manager
Install Brook SDK using your preferred package manager:- npm
- pnpm
- yarn
CDN (Browser)
For quick prototypes or simple HTML pages, use the CDN version:See the JavaScript SDK guide for a complete browser example.
Get Your API Key
Before using the Brook SDK, you’ll need to get your API key from the Console.1
Visit the Console
Navigate to https://console.aptly.cloud/brook
2
Sign in or create an account
Create a new account or sign in to your existing account
3
Generate API Key
Copy your API key from the dashboard
Understanding Key Types
Aptly provides two types of API keys:- Public Key (pk_)
- Server Key (sk_)
For client-side applicationsUse public keys in browsers, mobile apps, and any client-side code. These keys are protected by origin validation.
Learn More About Authentication
Read the complete guide on Public Keys vs Server Keys
Quick Start
- JavaScript
- React
- Go
- Browser/CDN
Next Steps
JavaScript SDK
Learn how to use Brook with vanilla JavaScript
Go SDK
Build real-time applications with Go
React SDK
Integrate Brook into your React applications
REST API
Publish messages using REST API with curl or fetch