Tuesday, December 18, 2018

Firebase : Can the push notification be sent to any string?

Yes provided the topic string has the character range [a-zA-Z0-9-_.~%]+ , so if @ is present, it is not going to be a valid one.

Topic provided to sendToTopic() must be a string which matches the format "/topics/[a-zA-Z0-9-_.~%]+". at FirebaseMessagingError.Error (native) at FirebaseMessagingError.FirebaseError [as constructor] (/user_code/node_modules/firebase-admin/lib/utils/error.js:39:28) at FirebaseMessagingError.PrefixedFirebaseError [as constructor] (/user_code/node_modules/firebase-admin/lib/utils/error.js:85:28) at new FirebaseMessagingError (/user_code/node_modules/firebase-admin/lib/utils/error.js:241:16) at Messaging.validateTopic (/user_code/node_modules/firebase-admin/lib/messaging/messaging.js:642:19) at /user_code/node_modules/firebase-admin/lib/messaging/messaging.js:328:19 at process._tickDomainCallback (internal/process/next_tick.js:135:7)

references:
https://stackoverflow.com/questions/4374822/remove-all-special-characters-with-regexp

No comments:

Post a Comment