Skip to content
This repository has been archived by the owner on May 13, 2023. It is now read-only.

make compatible with flutter web #6

Merged
merged 6 commits into from Feb 5, 2021
Merged

Conversation

TimWhiting
Copy link
Contributor

@TimWhiting TimWhiting commented Feb 4, 2021

What kind of change does this PR introduce?

This change introduces an indirection in creating the default websocket to allow for web compatibility

What is the current behavior?

Web doesn't work unless you create a realtime client directly with the HtmlWebSocketChannel. Web support is missing on pub.dev in both supabase and realtime_client
Example error:
Socket error: Unsupported operation: Platform._version

What is the new behavior?

No new behavior except for the web

Additional context

@TimWhiting
Copy link
Contributor Author

TimWhiting commented Feb 4, 2021

Probably should test this with a real app before making the claim of web compatibility, but I'm just getting started with supabase and don't have an app to test it on yet. I've made a similar change in another library using websocket_channel so I'm fairly confident it will work though.

Edit:
Just tested it on a basic app using the sample Countries database. Seems to work better than before. (I'm getting feedback from the RealtimeClient.onMessage callback). However, I'm not getting anything from a SupabaseQueryBuilder.on method, but that is the same behavior on MacOS and web.

@phamhieu
Copy link
Member

phamhieu commented Feb 4, 2021

Hi @TimWhiting I pushed a fix related to channel subscription. Can you merge with the main branch and test again.

Thanks for the websocket update 👍

@TimWhiting
Copy link
Contributor Author

@phamhieu
Merged with main branch.

@TimWhiting
Copy link
Contributor Author

Also tested it. Thanks for the new realtime example code in the supabase package. I noticed however that the olds field in the SupabaseRealtimePayload always has null for all columns in the table except the id on a DELETE. Is that expected?

@phamhieu
Copy link
Member

phamhieu commented Feb 5, 2021

I noticed however that the olds field in the SupabaseRealtimePayload always has null for all columns in the table except the id on a DELETE. Is that expected?

yes, that's right. Only record ID is available for a delete event.

@phamhieu
Copy link
Member

phamhieu commented Feb 5, 2021

The code looks good to me 👍

I will merge this PR after you fix the conflicts. Thank you.

@TimWhiting
Copy link
Contributor Author

@phamhieu
Fixed the conflict

@phamhieu phamhieu merged commit e958ba8 into supabase:main Feb 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants