Forums

apns - Connection refused

hello all

I have a free account and Im trying to send a push notification (using apns-client) I get an error 'Connection refused'

I'm not sure if that because of some internal issue In my code, or is it the PythonAnywhere system that blocking me from connecting apple's apns servers.

anybody knows something about this issue?

Hi there, free users have restricted internet, to a whitelist of sites: https://www.pythonanywhere.com/whitelist/

I should add -- if the site you're connecting to has a publicly-accessible API then we can add it to the whitelist. Could you give some more details about the servers APNS uses? Perhaps we can whitelist them.

for sending push notifications:

gateway.sandbox.push.apple.com (port 2195) - for the sandbox environment

gateway.push.apple.com (port 2195) - for the production environment

u also have the addresses for using the feedback service:

feedback.sandbox.push.apple.com (port 2196)

feedback.push.apple.com (port 2196)

Ah, unfortunately that won't work -- I hadn't realised it wasn't an HTTP-based service. For boring technical reasons we can only whitelist HTTP- and HTTPS-based protocols on ports 80 and 443 respectively.

So do we need to get a paid account for sending push notifications through apple's apns api?

Yes, that's right. Free accounts only get HTTP and HTTPS access, and the APNS API (at least, last time we checked) is non-HTTP(S).