The WebSocket Sower
FEATURED BUILD project
Cloudflare-native SaaS escape
Realtime WebSocket channels with presence, built on a single Worker + one Durable Object class.
Architecture
Loadout
Cost delta
Tradeoffs
Get The WebSocket Sower
Save $499/mo · 12,475× cheaper
was renting
$499
now owning
$0.04
escape value
$499
external services replaced
$499/mo mapped
Pusher Channels
realtime channels
$499/mo
Worker + Durable Objects + WebSockets
Ably
realtime fallback target
varies
Same loadout
PubNub
realtime fallback target
varies
Same loadout
Architecture map
Realtime channels on Cloudflare
curated replacement loadout
Clients live
browser dashboard
mobile app
server event producer
Routes API
/ws/:channel
/events/publish
/channels/:id/auth
/presence/:channel
Edge router Worker
runtime
Workers HTTP + WebSocket upgrade
jobs
auth · rate limit · route event · choose channel actor
Channel Durable Object
model
one actor owns one channel room
state
socket set · presence map · fanout queue
connect
client opens socket
upgrade
Worker validates request
join
DO attaches session
fanout
event broadcasts back
Bindings 4
Durable Objects
channel actors + presence state
D1
message history + audit log
WebSockets
long-lived client connections
Workers
edge auth + publish API
Implemented features
ChannelsClient eventsMessage historyPresencePrivate channelsWebSockets
Teardown notes
The WebSocket Sower
We were paying hundreds a month for Pusher to fan out WebSocket messages to browsers. We replaced it in an afternoon with a Worker that accepts WS upgrades and a single Durable Object class that owns each channel.
Architecture
- Worker — terminates the WS upgrade, authenticates the client, routes to the channel DO.
- Durable Object (
ChannelDO) — one instance per channel slug; holds the connection set and fans out. - Presence — the DO keeps a
Map<userId, meta>; broadcasts join/leave on state change. - Hibernation API — WS sessions hibernate when idle, so memory cost is zero between messages.
What it gives you
Channels, presence, private channels (HMAC-signed), client events, message history via D1.
What it does not give you
A hosted dashboard. You read logs via wrangler tail. That is the trade.
Discussion · 0
sign in to comment →