Skip to content
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

feat: Allow setting timeout of RealtimeClient. #932

Merged
merged 1 commit into from
May 17, 2024

Conversation

nns52k
Copy link
Contributor

@nns52k nns52k commented May 16, 2024

What kind of change does this PR introduce?

Allow the ctor SupabaseClient to set timeout to a RealtimeClient.

What is the current behavior?

Due to the fact the timeout is a final field in RealtimeClient, we cannot change its value after the RealtimeClient is created, and because the RealtimeClient is created in the ctor of SupabaseClient, there is no way for users to set the timeout.

What is the new behavior?

The new behavior allow us to set the timeout of the RealtimeClient like this:

final SupabaseClient supabase = SupabaseClient(
  'https://your.supabase.address/',
  'your_anon_key',
  realtimeClientOptions: RealtimeClientOptions(timeout: Duration(minutes: 1)),
);

Additional context

My app is connecting Supabase through Tor proxy. It's normal to cost 10 or more seconds to build a WebSocket connection. However, the current default timeout of RealtimeClient is 10 seconds, which is too short, and very often leads to result of no WebSocket connection is created, and therefore no realtime feature is provided.

@nns52k nns52k changed the title supabase: Allow setting timeout of RealtimeClient. feat: Allow setting timeout of RealtimeClient. May 16, 2024
@nns52k nns52k changed the title feat: Allow setting timeout of RealtimeClient. chore: Allow setting timeout of RealtimeClient. May 16, 2024
@nns52k nns52k changed the title chore: Allow setting timeout of RealtimeClient. feat: Allow setting timeout of RealtimeClient. May 16, 2024
@nns52k nns52k force-pushed the main branch 2 times, most recently from 7874549 to a6180b5 Compare May 16, 2024 14:58
Copy link
Member

@dshukertjr dshukertjr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome! Thanks for the update.

@dshukertjr dshukertjr merged commit dba8bae into supabase:main May 17, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants