MainSDK
Search⌘K
Integrations

Ably

Use Ably for MainSDK real-time updates - API key, main.yaml, channel access, local testing and swapping.

1 interface1 driverWritten guide
Updated 2026-10-28

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.

Before you start

  1. Create an Ably app, one per environment.
  2. 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

main.yaml
realtime:
  driver: ably

How 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

app/orders/actions.ts
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

  • realtime is listed for phase 1, with no spec yet.
  • Keep personal data out of messages; send IDs and statuses.

Swap to or from it

main.yaml
realtime:
  driver: pusher   # was ably

Broadcast 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?

↑↓ moveEnter openEsc close

Not decided yet