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

[Feature Request] Return a Task from Track and Untrack methods #47

Closed
lourd opened this issue May 21, 2024 · 3 comments
Closed

[Feature Request] Return a Task from Track and Untrack methods #47

lourd opened this issue May 21, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@lourd
Copy link
Contributor

lourd commented May 21, 2024

Feature request

Is your feature request related to a problem? Please describe.

I would like my client to update a field in my database after joining a presence channel using the Track method.

I accidentally created a race condition bug between my client application and part of my back-end where the back-end service saw that a database field was updated and it reacted, getting the current presence state for the channel, seeing it was empty, and then doing cleanup.

I want my client to deterministically wait until the Track message has been successfully received by Supabase.

Describe the solution you'd like

The Track (and Untrack) methods should return a Task that can be awaited.

Describe alternatives you've considered

I tried adding my own application logic to wait for a presence sync where I saw my own user, but the presence sync event is triggered from the library locally when calling Track, so that's not the same as confirming the server received it.

Additional context

The Supabase realtime-js library has Track and Untrack methods that return a Promise.

@lourd lourd added the enhancement New feature or request label May 21, 2024
@acupofjose
Copy link
Contributor

Available in v7.0.1! Thanks for the issue @lourd

@lourd
Copy link
Contributor Author

lourd commented May 22, 2024

Hot damn, thanks @acupofjose!

@acupofjose
Copy link
Contributor

Yep! I'll get it pushed up to the main supabase lib in a moment should be in 1.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants