Ably
Use Ably for MainSDK real-time updates - API key, main.yaml, channel access, local testing and swapping.
Ably is a hosted real-time messaging service. In a MainSDK app it is a driver behind realtime: your server calls realtime.publish(), and clients listening with realtime.subscribe() get the update. Pick it as an alternative to Pusher when your team already uses Ably.
Interfaces it serves
Pick Ably in main.yaml for any of these. Your calls stay the same, and you can swap later.
realtimeBuilding for 0.3Driver ably Ably
later
realtime:
driver: ablySwap to another provider
Before you start
- Create an Ably app, one per environment.
- Create an API key for your server with only the capabilities it needs. Clients should get short-lived tokens, never the API key.
Store the API key in your secrets manager.
Configure
realtime:
driver: ablyHow the Ably driver takes its API key is not decided yet; it will be a secret: reference such as secret:ABLY_API_KEY (suggested name).
Use it
import { realtime } from "mainsdk";
await realtime.publish(`order:${order.id}`, { status: "shipped" });Local development and testing
createTestApp() from @mainsdk/testing runs realtime on its in-memory fake, and chaos.on("realtime", { outage: true }) simulates an outage.
What MainSDK adds on top
- Channel access checked per user and tenant.
- New broadcasts can go out in stages and pause on error spikes.
See Real-time updates.
Limits and notes
realtimeis listed for phase 1, with no spec yet.- Keep personal data out of messages; send IDs and statuses.
Swap to or from it
realtime:
driver: pusher # was ablyBroadcast holds no state in the provider, so it swaps with no migration.
FAQ
Can clients publish through Ably? Not through the catalog calls: clients subscribe and your server broadcasts.
Next
Open questions
Was this page helpful?