Open skam22 opened 6 months ago
export enum StreamFeedGroups { user = 'user', timeline = 'timeline', timeline_aggregated = 'timeline_aggregated', notification = 'notification', } const activityClient = connect( Config.STREAM_API_KEY, null, Config.STREAM_APP_ID, ); const timelineFeed = activityClient.feed( StreamFeedGroups.timeline, userId, // string userToken, // string ), const Component = () => { useEffect(() => { let subscription: Subscription | null = null; timelineFeed.subscribe((data) => { console.log('New timeline data received':, data); }).then((fayeSubscription: Subscription) => { subscription = fayeSubscription; console.log('Timeline listener established', subscription); // expected object: type Subscription = { cancel: () => void; }; // actual: undefined }).catch(error => { if (error instanceof Error) { console.error('Error setting up timeline listener', error) } }); return () => { subscription?.cancel(); subscription = null; } },[]) return ( ... ) }