0

I am using Firestore as my backend, understand the availability of FCM, and am trying to incorporate push notifications into my app, scrummaging through documentation to see how I may trigger a push notification based on several events (i.e. direct message received, invitation received, etc).

However, it appears I need to setup a server and need server-side code to the push notifications I need.

Is it at all possible to do it on the client side with Swift? I haven't been able to find anything and hardly have any experience with server-side code/setting up a server. I might scrap push notifications altogether..

Any guidance would be appreciated.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Chris
  • 431
  • 8
  • 33
  • It's strongly recommended not to try to send messages in the client, because that would involve putting your admin credentials in the app, and that puts your project security at extreme risk. Instead, you should use something like Cloud Functions for Firebase if you don't want to set up a server. – Doug Stevenson Jun 15 '18 at 01:18
  • Sending messages **to** a device with FCM requires that you specify the so-called FCM server key. As its name implies, this key should only be used in a server or otherwise trusted environment. If you use it in client-side code, anyone can take the key and send messages to all your users on your behalf - not a risk you should be willing to take. Also see https://stackoverflow.com/q/37634046 and https://stackoverflow.com/questions/38432243/how-to-send-device-to-device-notification-by-using-fcm-without-using-xmpp-or-any/39279716#39279716 – Frank van Puffelen Jun 15 '18 at 04:03

0 Answers0