Skip to content
This repository has been archived by the owner on Mar 25, 2023. It is now read-only.

Feature: Implement WebSocket durable state upon Cloudflare workers #2

Open
williamlsh opened this issue Jul 28, 2022 · 1 comment
Open
Labels
Feature Features to implement
Milestone

Comments

@williamlsh
Copy link
Owner

Since Cloudflare workers are actually stateless, creating a websocket global state is impossible. though its runtime provides Durable Objects, but this feature is not within free plan.

Upstash provides a service, making REST API over Redis possible, and it has a free plan. It should suffice this need.

References:

@williamlsh williamlsh added the Feature Features to implement label Jul 28, 2022
@williamlsh williamlsh added this to the Summer milestone Jul 28, 2022
@williamlsh
Copy link
Owner Author

Currently, Upstash Redis doesn't fully support Pub/Sub, so a redis client can't subscribe to a channel.

A possible workaround is to use a List instead. To mimic subscribe, Poping a list continually in a loop with a short sleeping time.

Reference:

williamlsh added a commit that referenced this issue Jul 28, 2022
williamlsh added a commit that referenced this issue Jul 30, 2022
williamlsh added a commit that referenced this issue Jul 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Feature Features to implement
Projects
None yet
Development

No branches or pull requests

1 participant