supabase / realtime-js

An isomorphic Javascript client for Supabase Realtime server.
https://supabase.com
MIT License
320 stars 58 forks source link

Eech heartbeat and channel join sends a new accessToken, even if token hasn't changed, same for channel join #434

Open lauri865 opened 1 week ago

lauri865 commented 1 week ago

Bug report

Describe the bug

Each setAuth call sends a new access_token payload (all good): https://github.com/supabase/realtime-js/blob/82e996685da8ecb75f327d7faf52096b5953c3c3/src/RealtimeClient.ts#L337-L347

Each sendHeartBeat call calls setAuth (even if accessToken hasn't changeD), which results in a lot of unnecessary messages being sent: https://github.com/supabase/realtime-js/blob/82e996685da8ecb75f327d7faf52096b5953c3c3/src/RealtimeClient.ts#L553-L574

Also, each call to join a channel triggers new call to access_token, even though the accessToken is also sent with the phx_join event already.

Are we being charged for all these unnecessary messages being sent?

lauri865 commented 1 week ago

We removed those additional payloads, and everything seems to be working fine at initial look:

We did it on a custom transport level for now.