Closed ParmarJigarr closed 1 year ago
Yes , i have already performed this steps still getting this error in catch block
Attach logs were you do request and get response on subscription. And logs with the error 422
event_log_61fba775059aea0011c02462.json.zip I am able to create session sucessfully , chatting is also working fine , i can also see the push notification token in our admin panel but for some reason i am getting 401 in push notification JSON this issue is only facing in IOS side !
This is event log of successfully send message event_log_6200adb8ebf9ca00184a7013.json.zip
Any update ?
@ParmarJigarr we brought a new push notifications library which addressed some issues https://github.com/ConnectyCube/connectycube-reactnative-samples/pull/296
Please read the details and provide a feedback/comments if any
Hello @ParmarJigarr, did you ever fix this issue ?
I'm seeing the exact same error message in the event_log_xxx.json
as you did. Thx.
@arnofo No brother , i am not able to send and receive push notification with connectycube :( , so i had implement push notification by REST API . Thank You
@arnofo could you let me know which issue you are having now
Here is the log from your backend : event_log_63d2baf5669b24002fd6130a.zip
This issue i am seeing is only on IOS.
I am using notifee with remote notification support as the library for receiving notifications : https://notifee.app/react-native/docs/ios/remote-notification-support
I was having issues with your library when opening (press action) notifications (especially when the app was in the background).
Everything works fine on Android.
I am now trying to test it on IOS but the notification never seems to be pushed to phone.
I believe it is not sent by APNs to the phone. Probably because of the 401 seen in the event_log_xxx.json
.
@arnofo according to backend log, the notification is failed to delivery with error status code 401, so the APNS server failed to accept the push request by some reason.
401 generally means Unauthorised. There could be one main reason:
Here it is :
Yes that was my understanding of the 401 as well but without a more precise error message, i am having a hard time finding what exactly goes wrong.
These kind of 401 mean that we cannot push to the APNs server or that the push message is rejected by the specific device targeted ?
@arnofo one more question
when you subscribe to pushes via 'create subscription' API, do you pass bundle_id
or not?
If yes, is it equal to bundle_id of you APNS certificate?
No i do not pass bundle_id
. I am going to try to debug again tomorrow, i will let you know if i find anything else.
@arnofo another idea is that you use wrong device token when subscribe to push notifications. It should be around 64 chars. Could you show an example of your device token so we can compare?
Also, please provide a code snippet how you obtain device token via notifee
lib. It might be you are using wrong method. Let's check together
Hello @DaveLomber
You were right i was not getting the proper token for IOS. I misunderstood the full scope of how the push notifications worked with ConnectyCube. (i did not do the initial setup on the project i am working on)
Connectycube uses firebase to send Android push notifications and APNs directly for IOS push notifications.
In my code, i was getting a token from Firebase for both platform :
// Get the token from FCM
const token = await messaging().getToken();
I should have been using the package @react-native-community/push-notification-ios :
// Request permissions (required for iOS)
// requestPermissions will trigger registerForRemoteNotifications implicitly.
// register listener will get device token.
PushNotificationIOS.requestPermissions({
alert: true,
badge: true,
sound: true,
});
PushNotificationIOS.addEventListener('register', (token) => {
const token = token;
});
Then you use the token to create the subscription on Connectycube.
Few other clues that might help people that wanted to use notifee
:
messaging().onMessage
and messaging().setBackgroundMessageHandler
to listen for firebase push notificationPushNotificationIOS.addEventListener('notification', ... )
to listen for APNs push notificationnotifee
: notifee.displayNotification
press
actions and openings with notifee.onForegroundEvent
and for completeness i also use notifee notifee.getInitialNotification
when the app is opening from quit
state.(I still have a few edge cases to handle but most of the solution is working now)
Thanks for the help @DaveLomber.
@arnofo thanks for confirming it!
For someone who might use the notifee
lib as well - we added a ref to this GitHub issue from documentation https://developers.connectycube.com/reactnative/push-notifications?id=notifee-lib
I will close the issue for now then, feel free to open another one for any other issues/questions
'Users with ids 5351459 do not have push notification subscriptions' when sending msg using react native