Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure new provider works with older server versions #363

Conversation

paulgb
Copy link
Member

@paulgb paulgb commented Dec 18, 2024

The new client relies on a message type in order to support heartbeats and sync status. If it's talking to an older server version, the server will ignore its requests for heartbeats, and the client will assume the connection is unhealthy and attempt to reconnect in a periodic loop.

To test this, run the examples along with an old version of the server, e.g. npx [email protected] serve

This fixes the library by adding a boolean field receivedAtLeastOneSyncResponse. As long as this is false, we will continue to send heartbeats and sync status requests, but we will never terminate a connection over a missed heartbeat.

This is a somewhat crude approach. We should support version negotiation eventually. But it's nice and simple, and will be easy to rip out later.

Copy link

vercel bot commented Dec 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
y-sweet-demos ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 18, 2024 6:15pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
y-sweet-debugger ⬜️ Ignored (Inspect) Visit Preview Dec 18, 2024 6:15pm
y-sweet-gendocs ⬜️ Ignored (Inspect) Visit Preview Dec 18, 2024 6:15pm

Copy link
Contributor

@jakelazaroff jakelazaroff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@paulgb paulgb merged commit 87f4224 into main Dec 18, 2024
7 checks passed
@paulgb paulgb deleted the paul/dis-3054-ensure-new-y-sweet-client-works-on-older-server-versions branch December 18, 2024 18:43
paulgb added a commit that referenced this pull request Dec 18, 2024
Rebase after #363 is merged.
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.

3 participants