supabase / realtime-js

An isomorphic Javascript client for Supabase Realtime server.

Home Page:https://supabase.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Presence track function , unclear response.

kyeshmz opened this issue · comments

Improve documentation

Link

Add a link to the page which needs improvement (if relevant)
https://supabase.com/docs/guides/realtime/presence

Describe the problem

Presence track function returns a response, but this is not the case all the time.
Does presence need some kind of ack config?

Is the documentation missing? Or is it confusing? Why is it confusing?

Describe the improvement

A clear and concise description of the improvement.

The typescript shows how it is waiting for some "ok" or "error", but it is unclear how the subscribers should return this.

It is also kind of confusing how you can also use "send" rather than "track" for sending through presence.

Additional context

I am using valtio state manager to create my channel, which has both broadcast and presence subscriptions.

const tmpGuessChannel = supabaseClient
      .channel("game_channel", {
        config: {
          broadcast: { self: true },
        },
      })
realtimeState.realtimeChannel = ref(tmpGuessChannel)

In another function I call

 const test = await realtimeState.realtimeChannel!.track({
    state: state,
  });

This test is never consoled out and this await never resolves, making it necessary to avoid await for this function.

Add any other context or screenshots that help clarify your question.

@kyeshmz we're in the process of fixing this with PR #290. Involves a Realtime server change as well that's documented on that PR.

Hi @w3b6x9 I see the error handling in the PR, but is the documentation in a different PR? Is the error callback from other clients automatic?