Skip to content

feat(cloudflare)!: support global publish via rpc#166

Merged
pi0 merged 1 commit intomainfrom
feat/cf-global-publish
May 21, 2025
Merged

feat(cloudflare)!: support global publish via rpc#166
pi0 merged 1 commit intomainfrom
feat/cf-global-publish

Conversation

@pi0
Copy link
Copy Markdown
Member

@pi0 pi0 commented May 21, 2025

This PR enables global ws.publish(topic, message, opts) to work with Cloudflare Durable Adapter out of the box.

When ws.publish(...) is called, the durable object stub is resolved and called with arguments using RPC. Then, in the context of the durable object, publishing happens.

Requirements:

  • Compatibility date >=2024-04-03 (or rpc compatibility flag)
  • New webSocketPublish being exported from durable object calling ws.handleDurablePublish (see docs/example)

Breaking changes:

  • Custom resolveDurableStub(req, env, ctx) should handle cases where req and ctx are undefined

@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@pi0 pi0 merged commit 5e3ac18 into main May 21, 2025
4 checks passed
@pi0 pi0 deleted the feat/cf-global-publish branch May 21, 2025 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant