使用Go中的模块在App Engine上保持与APN的连接打开

I'm trying to implement iOS push notifications for a message board app I've written (so like notification for new message etc. etc.) but have no real idea where to start.

A lot the current documentation seems to be out of date in regard to keeping persistent TLS connections open to the APNs from App Engine and links to articles about deprecated backends. I'm using the Go runtime and just keep getting stuck. For instance, the creation of the socket connection to APNs requires a Context which can only be got from a HTTP request, but architecturally this doesn't seem to make a lot of sense because ideally the socket remains open regardless.

Is there any clearer guides around that I'm missing or right now is it a better idea to set up a separate VPS or compute instance to handle it?

I'm not that familiar with Go but if you cannot figure out how to connect to APNS in Go then I would recommend creating a separate Java Module that would be responsible for sending push notifications to APNS and a Task Queue to send 'hey-send-this-push-notification' messages (tasks) from Go to this Java Module. You could enqueue tasks from Go and process them in your Java Module.

There is an open-source, Java APNS library that you can use to send push notifications. It was specifically designed to work (and be used) on Google App Engine.



Backends are deprecated; use Modules:

https://developers.google.com/appengine/docs/java/modules/ https://developers.google.com/appengine/docs/go/modules/

Regarding enqueuing tasks:

https://developers.google.com/appengine/docs/java/taskqueue/ https://developers.google.com/appengine/docs/go/taskqueue/