Send Push Notifications Through Proxy (APNs and GCM) - proxy

I have built both ios and android apps which will receive push notifications. The problems are NOT from device side but from server side.
Because our company's internal server must connect to external network through Proxy, when users send notifications to mobile devices, the server which handles sending notification request must send request to proxy server then proxy server forwards request to APNs and GCM.
I have no idea about how to send push notification requests through proxy. I have studies in this case for several days, but no solutions have been found.
I saw some guys said APNs does not allow connections coming from Proxy Server. Only direct connection is accepted. Is that true? Is there any official docs mentioned it?
Is there anyone able to help me?
I wanna know how to send push notification through proxy for ios and android.

If you are using Java.You can use javaApns enter link description here for ios. I my self have problem right now to get GCM to send through proxy on my Server local it works. If you can you can configure the application server to send through proxy.

Related

Push notification from local API in xamarin forms

I am having an API locally hosted in one of the servers (LAN). What I am looking to understand if it is feasible to enable push notification from the server in case of a record entry. Every time a post request is made to the local server, Is it possible to push a notification to a certain mobile device? Please note, I am not considering push notification from web services such as google, Azure, Firebase etc.
It is feasible.
As Sushi said, you can use WebSockets or other Sockets to keep connect between Apps and Server. When client connected to your server, server will record which app is connecting.
By the way, you can custom notification's url between server and app.Use some special characters to distinguish between your various parameters, such as &/[ ]. You are free to set the header and body style of the message. Also, when your message needs to be encrypted, some encryption methods can be used.
Here is a similar discussion about Building an Android notification server can be refer .

Should I use a different certificate for the APNS HTTP2 API?

Recently, I want to change my codes of pushing notifications to apple from basing on old binary API to new http2 API. The question is that should I use a different certificate for this http2 API when I connect to apple ? Because when I send a notification to apple with a valid token(the token is valid when I send notifications with old API) using http2 API, it returns "BadDeviceToken". So I'm wondering whether the token is really bad or the certificate that I use is not qualified .
We were also trying to break our heads with such an issue where we were trying to send push to production device tokens using the HTTP/2 API but were getting {"reason":"BadDeviceToken"} as the response and it was a clear mistake from our side, we were using the same code that we were using for test push notifications on dev environment to send push notifications on production, which was sending push to
https://api.development.push.apple.com/3/device/
rather for production it should be
https://api.push.apple.com/3/device
Hope it helps somebody but one issue with the new API is the distribution SSL certificate works for both the sandbox and production, not the other way round so be careful.
You can still use your old certificate with the new HTTP/2 API.
The BadDeviceToken is most commonly because you are trying to push through their production gateway wth a development token or vice versa.
Tokens are only valid for either development or production, and this is determined by the provisioning profile of your app.

Websocket send not working from phone network

I have a game based on websockets for real-time. With WIFI everything is working as expected. But over phone network, the connection is opened but messages aren't received on the server. While the server pings are received at the client. I am using websocket implementation on heroku using ruby/sinatra for the server and my client is an android app using a websocket library.
This behavior only happens from a 3G phone network and not WIFI.
I have read about websockets not working from phone network because of proxy servers used by phone network providers, then how come I receive the pings from the server? Please help.
I resolved this issue by passing it over SSL. I used wss:// instead of ws:// and it worked fine even over phone network.

APNS spoof/fake

I want to have a standalone network (no internet access) for testing. Is there any way to spoof the APNS servers to test notifications and MDM. Is there a way to create your own APNS server.
Sure. The APNS protocol is defined in Apple's documentation here: The Binary Interface and Notification Formats. Basically, it's just an SSL server that speaks a simple binary protocol. We have implemented a mock push server and feedback server for our internal testing.

apple push notification server

How can I verify that if I have established a successful connection with apple push notification service with my apns provider. I am sending device token to server and I am not able to send it to my device.
You can simply check the status of the ssl connexion. What language do you use?

Resources