Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

iOS and MacOS / iOS push notifications

Author
Message
Naphier
11
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 14th Nov 2013 20:28
Hi everyone.
I'm getting ready to implement push notifications in our game so that players know when they have a game invite or it is their turn in a game. The Android push setup seems pretty simple, but iOS is a bit more involved (as usual).
Can anyone point me to a good guide on this?
Also it looks like I need an SSL certificate. I'm currently on a shared hosting plan and can get an SSL, but I'm wondering if anyone know if I'll have other issues with being on a shared hosting plan. Thanks!

Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 14th Nov 2013 20:57
Quote: "but I'm wondering if anyone know if I'll have other issues with being on a shared hosting plan"

As long as your hoster (who is?) properly isolates the individual accounts, you should not have an issue.

I am assuming that you have an actual domain and are not using a subdomain (which can't really have an SSL on it). As far as apps and the world are concerned, they don't know or care if you are on a shared hosting plan instead of a dedicated box or virtual private server. As long as they get to the right place when a URL is entered (or the IP address, once you have a dedicated one, which is required for an SSL certificate), it doesn't matter.

I have web clients who use both shared hosting and hosting on a virtual private server. In both cases, an SSL is used and there are no problems at all.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
11
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 14th Nov 2013 21:02
The host is Jaguar PC
The more I read into it, it looks like the reason for needing a dedicated server/VPS because I need access to certain ports and the ability to run background services / cron jobs.
Also something about TSL (no idea what it is- but sounds related to SSL).
Apple just can't make anything simple

Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 14th Nov 2013 21:24
You can do cron jobs in the JagPC shared hosting environment, no problem.

I don't know about using specific ports. I suspect not on a shared hosting account.

What do you need the ports for?

Where do you see something about TSL (which I don't know anything about, either)?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
11
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 14th Nov 2013 21:43
This is the guide I'm reading:
http://www.raywenderlich.com/32963/apple-push-notification-services-in-ios-6-tutorial-part-2

Would you mind reading it through for me since you have a lot more knowledge about servers than me? It really looks like I don't need a regular SSL, but I need an SSL that Apple seems to provide.
This guy mentions TSL and then the Apple Developer guide makes mention of it too, but they say TSL or SSL...
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW1

The folks at Jaguar said they can look at opening ports for me once I know what ones, but if I have a dedicated server or VPS I can set whatever I want.
I see the cron jobs now on my cPanel, looked for it about a dozen times and apparently I was blind.

What do you think about all of this? It sort of seems like I don't really need VPS/dedicated or my own SSL, but it's hard to tell for sure.

Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 14th Nov 2013 23:24
I will try to take a look at these tomorrow, in more detail.

A quick look at the first link seems to indicate that you can pick just about any port you want to communicate with your server. But shouldn't pick one commonly used by other things (like 80 and 443). And his setup is assuming using your Mac for a test server.

I'll look further tomorrow.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
11
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 14th Nov 2013 23:25
Thanks, AL I appreciate your help as always.

Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 15th Nov 2013 17:19
From looking at the first part of the tutorial related to the link you posted for the second part, you will be receiving some token from the app that it gets from the Apple server after registering for push notifications. Your app then sends that to your server (with whatever other information you need). Then you use that token when you send pushes to the Apple server (in response to stuff happening in your app, I assume).

It has a lot of good information about setting stuff up for Pushing. I've not looked into it because I don't see using it any time soon.

It does seem to indicate that the specific SSL certificate required to be used is generated by Apple. But I still haven't been able to figure out how you get it to your server. As best as I can tell, once you generate it on your Mac and create the .pem files, you will need to upload some or all of those bits to your server. Probably to the same directory as your PHP scripts.

I tested the bits for telneting to the APNS on my Mac Mini and got through. Then I tested on my JagPC VPS and could not. But that is probably because I don't have port 2195 open (I keep my VPS very tight).

I suspect the upshot is that I think you will need to go the VPS route. If you do, you can request that JagPC make sure that the needed ports are open from the beginning. They will help you move your hosting account to a VPS free of charge. This means that everything you have on your hosting account will be on the VPS (email accounts, database and such).

Following some links in the tutorial, it looks like you need to make sure that JagPC opens ports 5223 and 2195 for your use. But I would not be surprised if they do have an issue with that on a shared hosting account. It might be that you have no choice but to get a VPS (where you control the ports).

And, it does look like there will be things that need to be done at the command line level on your server. This would require a VPS or better.

What I don't see in AppGameKit is how you actually receive and process push notifications. There are only two commands related to setting up and getting the token to send to your server.

I'm not sure I am being very helpful here.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
11
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 15th Nov 2013 17:38
That is very very helpful. Thank you so much for trying this out and giving me some clues. I can answer some of the questions you have as well:
Quote: "It does seem to indicate that the specific SSL certificate required to be used is generated by Apple. But I still haven't been able to figure out how you get it to your server. As best as I can tell, once you generate it on your Mac and create the .pem files, you will need to upload some or all of those bits to your server. Probably to the same directory as your PHP scripts."

It looks like just that, copy the PEM file to the same directory for your PHP scripts. Either he says that somewhere in the tutorial or another tutorial I read does.

Sounds like I'll definitely need to go VPS, not a problem, just needed to make sure.

AGK itself does not handle the push notification receipt. The token is specific to your device, Apple or Google checks the token and your app's key against the installed apps on the user's device. If the app is installed then the push notification is sent to the device, is matched up with the application so an icon can be shown and tapping the notification will allow the app to launch.
AGK really has no way of knowing the notification was received, although I think you can program native apps to know and respond to the payload (but I'm not sure).

I believe the device or the push service also prevents things like multiple notifications from a single app stacking up in your notification bar. I'm not 100% sure about this, but I've not seen more than one push notification for an app in the notification bar at one time. Standard, app created, notifications are different. For example, I think Gmail app creates its own notifications and is always running in the background to do so (or the is a similar app service running that does it). But for most apps this is inappropriate and for AppGameKit apps there is no way to self generate a non-push notification as of yet.

Does that help things make a little more sense?
Again thanks, this is a big help knowing what I really need for my server setup. Now on to the big task of actually setting up APNS... I think GCM will take about 3 hours... APNS will take at least a day.

Ancient Lady
Valued Member
18
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 15th Nov 2013 18:09
Quote: "Does that help things make a little more sense?"

Yes it does.

I suspect the Linux VPS Plus plan is probably your best bet.

Since you have an existing hosting plan, I suggest contacting them to order the VPS and get your stuff transferred. You definitely will want the 'Managed Services & Cpanel' (this is WHM/Cpanel). Otherwise you have to do everything at the command line level and that can be a royal pain. The control panel is definitely worth it. And, if given the choice, pick the SolusVM for the VPS control panel. It uses a different user name and password than your VPS. So, in the event that something happens so that you cannot log into your VPS through WHM or FTP because the root password got changed, you can use the SolusVM interface to reset your VPS root password. One time (and one time only) a JagPC support person (who must have been new) changed my root password so they could do something that I requested and didn't tell me. Normally, they will ask for your root password when you ask them to do something (and they can be trusted with it, but you can change it any time you want).

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Login to post a reply

Server time is: 2022-09-25 22:09:14
Your offset time is: 2022-09-25 22:09:14