APN push notifications for chat

465 Views Asked by At

I'm trying to add notifications to a private chat app that uses Firebase, unfortunately Firebase has an APN service but it must be configured and needs also a server app to manage it. I'd like to have the user notified when someone is texting him while the app is in the background. The problem is that APN (Apple Push Notifications) requires a server with a certificate and that is ok with me, but I'm looking for a way to send push notifications from an iOS device to another device, I mean device-to-device push notifications and the server has just to relay the messages as they are. In my case the APN server should only relay the messages that it receives from a source device to the destination device. I couldn't find a way to obtain that without writing sever code. I want to use pre-built existing services. Has anybody any idea on how to send push notifications from one device to another without configuring and writing server apps? I tried a workaround using the background fetch iOS feature, but the system si randomly giving my app execution time... and that means that my app could wait hours before being started by the system... so that is not a viable solution. Please help

2

There are 2 best solutions below

0
On BEST ANSWER

Ok, probably what I found out could be helpful for others. Actually what I'm looking for can be directly integrated in the app. You need a library like NWPusher (free on GitHub) which can be imported, and with just a few lines of code and the APN device token you get from the system, it is possibile to implement APN notifications... easily, but most importantly... for free.

UPDATE Check also APNS framework on GitHub. It's written in Swift 3.0 and it supports the latest features.

1
On

You are essentially looking for a messaging / chat API to handle device-to-device communication. You might want to try Pusher or PubNub