ยฉ 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabaseโ€ข4y agoโ€ข
2 replies
stevharve

Realtime not receiving events

For around the first 5 seconds of the realtime subscription subscribing it doesn't receive the insert event. I have already tried to listen to the isJoined boolean but that is true before the subscription starts receiving events.

 useEffect(() => {
  const subscription = supabase
    .channel('public:messages')
    .on(
      'postgres_changes',
      {
        event: 'INSERT',
        schema: 'public',
        table: 'messages',
        // filter: 'team_id.eq.' + teamId,
      },
      async (payload: any) => {
        onInsert && onInsert();
      }
    )
    .subscribe((status: string) => {
      console.log('status', status);
      status === 'SUBSCRIBED' && onConnection && onConnection();
    });

  return () => {
    subscription.unsubscribe();
  };
}, [teamId]);
 useEffect(() => {
  const subscription = supabase
    .channel('public:messages')
    .on(
      'postgres_changes',
      {
        event: 'INSERT',
        schema: 'public',
        table: 'messages',
        // filter: 'team_id.eq.' + teamId,
      },
      async (payload: any) => {
        onInsert && onInsert();
      }
    )
    .subscribe((status: string) => {
      console.log('status', status);
      status === 'SUBSCRIBED' && onConnection && onConnection();
    });

  return () => {
    subscription.unsubscribe();
  };
}, [teamId]);
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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

New Setup Realtime subscription not receiving data
SupabaseSSupabase / help-and-questions
4y ago
Realtime only getting DELETE events
SupabaseSSupabase / help-and-questions
6mo ago
realtime only emitting DELETE events no INSERT or UPDATE events
SupabaseSSupabase / help-and-questions
4y ago
Realtime Limit But not using Realtime
SupabaseSSupabase / help-and-questions
7d ago