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

Make WebSocket subscriptions receive ack to be considered subscribed #409

Merged
merged 1 commit into from
Oct 22, 2024

Conversation

benjreinhart
Copy link
Contributor

This allows us to implement logic where we only send events once the server has confirmed our subscription. This ensures that the server will not try to broadcast something before we're subscribed, leading to events that never make it to the client.

This probably mostly only happens in dev because of the mounting/unmounting/remounting resulting in useEffect running multiple times initially. There's a small window where events can get dropped in that. In a production build, it's more unlikely we'd have issues here, but this is good in either case as subscriptions really should be acknowledged by the server before we start sending events.

@benjreinhart benjreinhart requested a review from 1egoman October 22, 2024 19:32
@benjreinhart benjreinhart merged commit 45b6bfa into main Oct 22, 2024
3 checks passed
@benjreinhart benjreinhart deleted the ws-subscribe branch October 22, 2024 19:40
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.

2 participants