-
Notifications
You must be signed in to change notification settings - Fork 12
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
Realtime socket communication is not normal. #24
Comments
I checked it out. After checking, the item in Realtime's Subscription table was anon permission. To change this, I gave the new client an AccessKey, but the Subscribe method did not work this time. (i.e. not registered in the subscription table) Judging from this, I thought it only works for the anon key as described in the description in the supabase, but as I told you in the last article, it works from the second time. When I uploaded the file, the anon permission of the linked account in the Subscribe table was changed to authenticated. In fact, I have a question about this. I chose the table as From in StatelessClient and declared it because it has On, but I couldn't test this because there was an error because I don't have Connect or Subscribe. And for some reason, I checked that the upload progress was recorded in Debug in this update. What went straight to 0% ->100% was fixed. Thank you! |
Hi. After a lot of tests, I checked what the problem is.
Since I wrote it like this, I checked that when I called the Subscribe() method, a row was added to the realtime->subscription table and claims_role became anon. After 10 seconds, I experienced that the claims_role changes to authenticated when I refresh. The reason is that On contains a code that adds user_token as a parameter. First of all, there's a problem that I don't know why there's a 10-second delay, and if I can update this quickly, I think I can solve the fundamental problem. The problem is that I didn't use On, I used SupabaseClient.Realtime.Channel("realtime", "public", "WORKS"). WORKS is my table here. If I make a channel with this, it's fixed as anon and it didn't change. And when I looked at the code, I found something that I had to send parameters when I made the channel. It's a shame there wasn't such an explanation. I don't think anyone knows that we have to send user_token to the parameter. As I did so, I confirmed that anon changed to authenticated after about 10 seconds like the On written above. But I can't receive any changes in real time because I'm anon for 10 seconds anyway. If I could check the changes in climes_role as an event, I would block other movements or turn the busyIndicator, but I don't know at the moment. If there is a user Access Token key in "Authorization" by looking up the header inside the client when creating the channel, I think the code will generate user_token. Of course, depending on the developer's intention, some people want to do it with anon. And I told you that I uploaded the file and the permission changed? At this time, there seems to be something updating claims_role on the server, so if call taht, wouldn't we be able to reduce the delay of 10 seconds? I'm sorry I only found weird things :) |
Oh, I think I found it. After running the Subscribe() method to subscribe to events coming from the Channel, the developer must issue commands or write code.
or
Actually, the contents of No. 2 are included in SetAuth. When I wrote it like this, I confirmed that the claims_role was changed from anon to authenticated within a term of 2 seconds. It would be more convenient to automatically check SetAuth() when the Subscribe() method works, but I'm proud to find the answer anyway. Thank you for making a good service! |
I experienced the same. Calling SetAuth is not enough. Pushing the access token did the trick for me, even without the SetAuth call. It did not matter whether I had AutoConnectRealtime on or off. I still think this is a bug or at least needs better documentation. |
@honeyhead thanks so much for digging into this. I was trying to debug last night and was running to the same issue. I think the current client has fallen behind on the proper handshake from the current deployed supabase realtime version! So this is very helpful. The intended implementation would be that the developer shouldn't have to call SetAuth or push an access token, it should be handled automatically by the library. I'll look into getting your suggestions pushed into the next version (with credit of course)! |
v5.0.2 will automatically push the access token to any channel on subscription - the timing issue you mentioned should also be fixed. Your name is included in the changelog. Thanks for your help @honeyhead! |
@acupofjose However, it seems inevitable that there will be a two-second delay. If so, is there a way to event check if Claim_Role is changed? |
I suppose we could make it to where the async |
I think each event should be defined before the Subscribe() method. However, in the process of initializing the supabase client, autorealtime may be given as true. What is certain is that the client must be able to recognize the state of the claim_role being changed before or after Subscribe() so that developers can deal with issues that they cannot receive due to lack of permission. If Supabase does not create a separate event, make sure that Claim_role changes and the code will work after await client.Subscribe() |
I brought a new error.
I am checking to define a table called WORKS as Realtime as below and import it.
And when I uploaded the file, I could see this message in the debug.
The problem is that you are receiving Realtime, but you cannot get anything.
And if you repeat the same behavior, it comes out as below.
[TrafficStats] disappears and real-time events are received.
When you receive a Realtime event, the first one feels ignored.
Do you happen to know about the content? I'm a MAUI developer, but I don't think it's an Android problem because I did the same test in the Windows environment.
The text was updated successfully, but these errors were encountered: