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]);
Was this page helpful?