Push notifications deliver real-time messages from a PraisonAI gateway to subscribed clients over WebSocket (with HTTP polling fallback).Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
PushClient requires the praisonai wrapper package (pip install praisonai). The core praisonaiagents package only ships the push protocols and ChannelMessage model — concrete client and transport implementations live in the wrapper. You can still import via from praisonaiagents.push import PushClient (a lazy re-export), or directly via from praisonai.push import PushClient.Quick Start
Install Prerequisites
PushClient and its transports ship in the praisonai wrapper package. Install it before importing:praisonaiagents package contains only the push protocols and the ChannelMessage model. The concrete PushClient, WebSocketTransport, and PollingTransport classes live in the wrapper.Agent-Centric Example
Import Paths
Two equivalent import paths are supported:praisonai wrapper package. The praisonaiagents.push path is kept for backward compatibility and will raise a clear ImportError if the praisonai wrapper is not installed.
The core praisonaiagents.push module only exports protocol-level types:
How It Works
| Component | Purpose |
|---|---|
| PushClient | Client SDK with auto-reconnect and transport fallback |
| WebSocket | Primary real-time transport |
| HTTP Polling | Fallback transport for restricted networks |
| Channels | Named message streams for pub/sub |
| Presence | Track online/offline status of clients |
| Delivery Guarantees | At-least-once message delivery with ACKs |
Configuration Options
PushConfig
| Option | Type | Default | Description |
|---|---|---|---|
enabled | bool | False | Feature toggle (push is opt-in; zero overhead when disabled) |
redis | Optional[RedisConfig] | None | Redis config for cross-server scaling |
presence | PresenceConfig | PresenceConfig() | Presence tracking settings |
delivery | DeliveryConfig | DeliveryConfig() | Delivery guarantee settings |
polling | PollingConfig | PollingConfig() | Polling fallback settings |
RedisConfig
| Option | Type | Default | Description |
|---|---|---|---|
url | Optional[str] | None | Full Redis URL (takes precedence over host/port) |
host | str | "localhost" | Redis host |
port | int | 6379 | Redis port |
db | int | 0 | Redis database number |
password | Optional[str] | None | Redis password |
prefix | str | "praison:push:" | Key prefix namespace |
max_connections | int | 20 | Connection pool size |
PresenceConfig
| Option | Type | Default | Description |
|---|---|---|---|
enabled | bool | True | Toggle presence tracking |
heartbeat_interval | int | 15 | Expected heartbeat frequency (seconds) |
offline_timeout | int | 45 | Mark offline after this many seconds without heartbeat |
broadcast_changes | bool | True | Broadcast presence changes to subscribed channels |
DeliveryConfig
| Option | Type | Default | Description |
|---|---|---|---|
enabled | bool | True | Toggle delivery guarantees |
ack_timeout | int | 30 | Seconds to wait for ACK before retrying |
max_retries | int | 3 | Maximum retry attempts |
retry_backoff | float | 2.0 | Exponential backoff multiplier |
message_ttl | int | 86400 | How long to retain unacknowledged messages (seconds) |
store_backend | str | "memory" | "memory" or "redis" |
PollingConfig
| Option | Type | Default | Description |
|---|---|---|---|
enabled | bool | True | Toggle polling fallback |
long_poll_timeout | int | 30 | Long-poll hang duration (seconds) |
max_batch_size | int | 100 | Max messages per poll response |
Custom Transports (Advanced)
ImplementPushTransportProtocol to plug in a custom transport (e.g. SSE, gRPC):
| Method / Property | Purpose |
|---|---|
is_connected (property) | Whether the transport is currently connected |
connect() | Establish the underlying connection |
disconnect() | Close the connection |
send(data) | Send a JSON-serialisable dict to the gateway |
receive() | Await and return the next JSON message from the gateway |
Common Patterns
Publish/Subscribe
One-shot Wait
Presence Tracking
Best Practices
When to Enable Redis
When to Enable Redis
Enable Redis when running multiple gateway servers that need to share push channels:Without Redis, channels only exist on a single gateway instance.
Choosing Delivery Store Backend
Choosing Delivery Store Backend
Use Use
memory for low-latency scenarios where message loss on restart is acceptable:redis for high-availability scenarios where messages must survive server restarts:Tuning Heartbeat and Timeout
Tuning Heartbeat and Timeout
Adjust based on network conditions and desired responsiveness:
When Polling Fallback Matters
When Polling Fallback Matters
Polling is crucial for corporate firewalls and mobile networks that block WebSocket connections:Clients automatically switch to HTTP polling if WebSocket connection fails.
Choosing a Transport
Related
Gateway
The gateway that hosts push notification channels
A2A Push Notifications
Webhook-based task updates (different from real-time channels)

