Authentication
Chat requires an authenticated client with aclientId to identify users. The recommended approach is:
- Client-side apps (browsers, iOS, Android): Use JWT authentication with
authCallbackto fetch JWTs from your server - Server-side apps (Node.js, Python, etc.): Use your API key directly
Install
The Chat SDK is built on top of the Ably Pub/Sub SDK and uses that to establish a connection with Ably.- Tab Title
- Tab Title
- Tab Title
- Tab Title
Install the Pub/Sub SDK and the Chat SDK:Import the SDKs into your project:
Instantiate a Client
Authentication is configured on the Ably Pub/Sub client, which the Chat client wraps. The Chat SDK itself doesn’t handle authentication directly - it uses the authenticated connection from the underlying Pub/Sub client.Client-side Authentication (Recommended)
Use token authentication for browsers and mobile apps:- Tab Title
- Tab Title
- Tab Title
- Tab Title
Server-side Authentication
For server-side applications or local development, you can use an API key directly:Next Steps
- Learn about authentication
- Understand connections
- Start building with rooms
