Golang: Send Push Notification to iOS device

By Ketan Parmar Go Language No Comments on Golang: Send Push Notification to iOS device

Assumptions:

  1. Go language is installed in your computer
  2. iOS sample application with APNs support for testing

Step1: Generate certificate PEM file. This article will help you to generate PEM https://www.raywenderlich.com/123862/push-notifications-tutorial

Step2: Install Go library for APNs

Step3: Write the following function in your main.go. Place certificate PEM file in config folder. You can change push URL as per your requirement.

Step4: Call “SendPushToClient” function from main function. Replace client token in the following code

Step5: Compile & run

Full source code main.go

Document: https://godoc.org/github.com/Coccodrillo/apns

  • Share:

Leave a comment