@@ -45,6 +45,11 @@ messaging().setBackgroundMessageHandler(async (remoteMessage) => {
4545 } ) ;
4646
4747 if ( message . message . user ?. name && message . message . text ) {
48+ const { stream, ...rest } = remoteMessage . data ?? { } ;
49+ const data = {
50+ ...rest ,
51+ ...( ( stream as unknown as Record < string , string > | undefined ) ?? { } ) , // extract and merge stream object if present
52+ } ;
4853 await notifee . displayNotification ( {
4954 android : {
5055 channelId,
@@ -53,7 +58,7 @@ messaging().setBackgroundMessageHandler(async (remoteMessage) => {
5358 } ,
5459 } ,
5560 body : message . message . text ,
56- data : remoteMessage . data ,
61+ data,
5762 title : 'New message from ' + message . message . user . name ,
5863 } ) ;
5964 }
@@ -111,6 +116,11 @@ export const useChatClient = () => {
111116 name : 'Foreground Messages' ,
112117 } ) ;
113118 // display the notification on foreground
119+ const { stream, ...rest } = remoteMessage . data ?? { } ;
120+ const data = {
121+ ...rest ,
122+ ...( ( stream as unknown as Record < string , string > | undefined ) ?? { } ) , // extract and merge stream object if present
123+ } ;
114124 await notifee . displayNotification ( {
115125 android : {
116126 channelId,
@@ -119,7 +129,7 @@ export const useChatClient = () => {
119129 } ,
120130 } ,
121131 body : message . message . text ,
122- data : remoteMessage . data ,
132+ data,
123133 title : 'New message from ' + message . message . user . name ,
124134 } ) ;
125135 }
0 commit comments