About Push notifications with vapor

Sorry but there doesn’t seem to be this topic in the forum. Does anyone share or suggest which to use?

i found something:




Any other idea?

Hey @choioi

So with push notifications you basically have 2 options:

  • Use a 3rd party services like Pusher, SNS, Urban Airship etc. This is usually the easiest route, works across iOS Android and Web and will be the quickest
  • Do it yourself.

Assuming you want to go down the DIY route you have a couple of options but nothing great at the moment. The main issue is that HTTP/2 support is limited to say the least. NIO2 now has HTTP/2 support, so you can either use Kitura like that or build on top of NIO2 directly (or wait for Vapor 4). Another option that the vapor-apns library uses is making sure you have access to HTTP/2 via Curl, which usually requires you to have a custom Docker container. But it’s definitely possible!

1 Like

Thanks i using https://github.com/MihaelIsaev/FCM, it’s very good

FWIW The APNSwift library doesn’t require curl, and supports HTTP/2.
Im the author of it and can answer any questions you may have.

Hey @choioi! , quick question since I haven’t been able to find anyone else who’s used https://github.com/MihaelIsaev/FCM library.

How do you send the Firebase Registration token to the Vapor code? I made my Token model conform to Firebaseable protocol like suggested in the FCM ReadMe, however I can’t find a good way to initialize the firebaseToken property in Token. I can’t call sendPush(…) without setting that :sweat:

in model User … i create firebaseToken: String after client login will sent this token to server and we saved it.

i try install APNSwift with vapor 4, but cant not import No such module ‘APNSwift’, which i missing for installed?

I am also getting same issue.

If you’re using Vapor, please install https://github.com/vapor/apns

1 Like

Yes, thanks , vapor/apns im using work fine with vapor4.

@choioi @ashi027 Do you still have issues with this?

No, i have no issue anymore., i using vapor/apns