-
Notifications
You must be signed in to change notification settings - Fork 50
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
SocketStateEventHandler not being called after reconnection #105
Comments
Okay! Late to the party. But if this is still an issue, I'd wonder if the socket is failing because of an expired token. Ideally the supabase client would handle your authentication and token renewal. So in your startup code, you'd just log in the user using the So adjust your async void Start()
{
Debug.Log("SupabaseManager start");
string url = SupabaseURL;
string key = SupabasePublicKey;
string userAccessToken = ApiClient.Get().AccessToken
string userRefreshToken = ApiClient.Get().RefreshToken // <---- This is important
_supabase = new Client(url, key);
await _supabase.InitializeAsync();
// Set session and start token refresh loop
await _supabase.Auth.SetSession(userAccessToken, userRefreshToken);
_supabase.Realtime.AddDebugHandler((sender, message, exception) => Debug.Log(message));
_supabase.Realtime.AddStateChangedHandler(SocketEventHandler);
var realtimeClient = await _supabase.Realtime.ConnectAsync();
Debug.Log("Is connected? " + realtimeClient.Socket?.IsConnected);
} |
Actually, please try again on 0.13.3 and see if that fixes it for you! |
Hey @acupofjose what would be the best way to update the library? I used to have an issue with making the library work (like mentioned here) unless I cloned the repo from here. But that repo doesn't seem to be updated with 0.13.3. Thank you |
I think you're looking for the wiki entry here! Unfortunately, I don't have write access to that repo, so I'm not much help there. |
FYI updated the template to latest as of 9/27/2023. Added @acupofjose as a contributor to the template in case I'm, I dunno, retire off to some beach with no Internet or something. ;) |
Hey, thanks for the quick turnaround! Any chance you can give a quick rundown of HOW you update the template to newer versions? So I don't have to wait/bug you in future updates Thanks! |
Right now I use the command line nuget to fetch the entire dependency graph that's in the wiki page on Unity. Then I manually remove a bunch of libraries (eg a bunch of the System and Newtonsoft Json) by hand that cause conflicts with Unity specific versions. It's a giant PITA TBH but I haven't needed to do it enough yet to do the Right Thing(tm) and make a GitHub Action to create a Unity package manager friendly version... yet. ;) |
Bug report
Describe the bug
For some unknown reason that I'm still trying to debug, my client is losing the connection to the socket. But besides that, once it reconnects, the SocketStateEventHandler is not being called.
Here is the Manager i'm using:
See code
And you can see in my logs where the socket gets disconnected (I left the stacktraces for those in case it gives some hints) but after each of the
Socket State Change
I was expecting to see theSocket is $state and username is $username and user_id is $user_id
line and that never happenedLogs
The text was updated successfully, but these errors were encountered: