The Ably Python SDK provides two main client interfaces:
The REST client (AblyRest) provides synchronous access to Ably's REST API:
- Publish messages to channels
- Query message history
- Manage channel lifecycle
- Retrieve statistics
- Token authentication
Use the REST client when you need simple request/response operations without maintaining a persistent connection.
The Realtime client (AblyRealtime) maintains a persistent connection to Ably:
- Subscribe to channels and receive messages in real-time
- Publish messages
- Monitor connection state
- Track presence
- Receive live updates
Use the Realtime client for applications that need live updates and bidirectional communication.
The Auth class handles authentication with Ably, supporting:
- API key authentication
- Token authentication
- Token generation and renewal
Channel interfaces provide access to messaging functionality:
- REST channels for publishing and history
- Realtime channels for subscribing to messages
- Channel state management
Message types represent the data sent through Ably:
Message- Standard pub/sub messagesPresenceMessage- Presence state changes- Encoding and encryption support
Core data types and configuration:
ClientOptions- Client configurationTokenDetails- Authentication tokensStats- Usage statistics- Channel and connection options
Utility functions and helpers:
- Exception types
- Encoding/decoding utilities
- Cryptographic functions
Both clients share common capabilities:
- Auto-reconnection: Automatic connection recovery
- Message queueing: Queues messages during disconnection
- Type safety: Full type hints for IDE support
- Async/await support: Native async support in Realtime client
- Error handling: Comprehensive error types