Prerequisites
- Sign up for an Ably account.
- Create a new app, and create your first API key in the API Keys tab of the dashboard.
- Your API key will need the
publishandsubscribecapabilities.
Step 1: Install the SDK
Install the Ably SDK for your platform:Step 2: Connect to Ably
Create a realtime client instance using your API key:Step 3: Get a channel
Channels are used to organize messages into different topics:Step 4: Subscribe to messages
Subscribe to receive messages published to the channel:Step 5: Publish a message
Publish a message to the channel:Complete example
Here’s a complete working example:Next steps
- Learn about authentication to secure your applications
- Explore channels to organize your messages
- Understand message format and metadata
- Try presence to track who’s online
- Access message history to retrieve past messages
