© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•3y ago•
33 replies
blazzingballs

realtime-js channel subscription status is TIMED_OUT

Adding my react-native code below. When I am running it parallel on two ios simulators, I get back that both the subscriptions have timed out.

  useEffect(() => {
    if (!userId) {
      console.log('No user ID available for subscription');
      return;
    }

    console.log('Setting up subscription for user ID:', userId);

    // Clear any existing subscriptions to avoid duplicate listeners
    supabase.removeAllChannels();

    // Set up a new channel subscription
    const channel = supabase.channel(
  useEffect(() => {
    if (!userId) {
      console.log('No user ID available for subscription');
      return;
    }

    console.log('Setting up subscription for user ID:', userId);

    // Clear any existing subscriptions to avoid duplicate listeners
    supabase.removeAllChannels();

    // Set up a new channel subscription
    const channel = supabase.channel(
${userId}-channel
);

    channel.on('postgres_changes', { event: 'UPDATE', schema: 'public', table: 'users', filter: 
);

    channel.on('postgres_changes', { event: 'UPDATE', schema: 'public', table: 'users', filter: 
user_id=eq.${userId} or matched_user_id=eq.${userId}
 }, (payload) => {
      console.log('All updates on users table when username is Realtime: ', payload)
      if (payload.new && (payload.new.user_id === userId || payload.new.matched_user_id === userId)) {
        setMatchedUser(payload.new.matched_user_id);
      }
    })

    channel.subscribe((status, error) => {
      console.log(
 }, (payload) => {
      console.log('All updates on users table when username is Realtime: ', payload)
      if (payload.new && (payload.new.user_id === userId || payload.new.matched_user_id === userId)) {
        setMatchedUser(payload.new.matched_user_id);
      }
    })

    channel.subscribe((status, error) => {
      console.log(
Subscription status: ${status}
, error ? 
, error ? 
Error: ${error.message}
 : '');
      if (status === 'SUBSCRIBED') {
        console.log('Successfully subscribed to the channel');
      }
    });

    // Return a cleanup function to unsubscribe from the channel
    return () => {
      console.log('Removing channel subscription for user ID:', userId);
      supabase.removeChannel(channel);
    };
  }, [userId]);
 : '');
      if (status === 'SUBSCRIBED') {
        console.log('Successfully subscribed to the channel');
      }
    });

    // Return a cleanup function to unsubscribe from the channel
    return () => {
      console.log('Removing channel subscription for user ID:', userId);
      supabase.removeChannel(channel);
    };
  }, [userId]);



Does realtime-js work with react-native on ios devices? I have updated to the latest version but still no luck. Can anyone suggest what might be wrong here?
image.png
image.png
image.png
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Supabase Realtime in long-running Node.js — is manual channel re-subscription required?
SupabaseSSupabase / help-and-questions
2mo ago
realtime subscription reliability
SupabaseSSupabase / help-and-questions
7mo ago
realtime subscription error - TS
SupabaseSSupabase / help-and-questions
3y ago
Realtime subscription stopped working
SupabaseSSupabase / help-and-questions
4y ago