Redth / PushSharp

A server-side library for sending Push Notifications to iOS (iPhone/iPad APNS), Android (C2DM and GCM - Google Cloud Message), Windows Phone, Windows 8, Amazon, Blackberry, and (soon) FirefoxOS devices!
Other
4.38k stars 1.52k forks source link

PushSharp hangs after apnsBroker.QueueNotification() #928

Open Poornima-singh opened 3 years ago

Poornima-singh commented 3 years ago

What version of PushSharp are you using?

4.0.10

Describe your issue:

After apnsBroker.QueueNotification() the http request hangs. No response is received. I tried in Postman and also waited couple of hours but seems like the there is no response from APNs even failure is not received. Please can you help me solve this issue? Is this PushSharp service issue? certificate issue? or APNs issue?

What are the steps required to reproduce this issue?

Please provide any Exception Stack Traces

This is what I see in my debug console APNS-Client[5]: Sending Batch ID=1, Count=1 2021-05-02 20:34:25.PM [INFO] APNS-Client[5]: Connecting (Batch ID=1) 2021-05-02 20:34:26.PM [INFO] APNS-Client[5]: Connected (Batch ID=1) 2021-05-02 20:34:26.PM [INFO] APNS-Client[5]: Sent Batch, waiting for possible response... 2021-05-02 20:34:26.PM [INFO] APNS-Client[5]: Data Available... 2021-05-02 20:34:26.PM [INFO] APNS-Client[5]: Finished Read. 2021-05-02 20:34:26.PM [INFO] APNS-Client[5]: Received 0 bytes response... 2021-05-02 20:34:26.PM [INFO] APNS-Client[5]: Server Closed Connection... 2021-05-02 20:34:26.PM [INFO] APNS-Client[5]: Disconnecting (Batch ID=1) 2021-05-02 20:34:26.PM [INFO] APNS-Client[5]: Disconnected (Batch ID=1) 2021-05-02 20:34:26.PM [INFO] APNS-Client[5]: Done Reading for Batch ID=1, reseting batch timer...

Poornima-singh commented 3 years ago

Hello, I have been debugging so the requests goes into hang state after apnsBroker.Stop(); this command.

21pg commented 3 years ago

@Poornima-singh We were also facing this issue in PushSharp, Assuming its because of - https://developer.apple.com/news/?id=c88acm2b so we discontinued and implemented dotAPNS which support HTTP/2 APNs API .. https://github.com/alexalok/dotAPNS Hope this will help

Poornima-singh commented 3 years ago

@21pg Thank you so much for your response. I also implemented dotAPNS, but unfortunately, it works in local and gives error when published. My solution is an asp.net solution and is published in Azure as App Service. I get below error. Failed to send a push. HTTP request failed: System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner exception.\r\n ---> System.ComponentModel.Win32Exception (0x8009030D): The credentials supplied to the package were not recognized

I don't know if it's the right solution to share this issue, but are you aware of anything in this regard?

21pg commented 3 years ago

@Poornima-singh Yes follow this thread- We are just able to resolve our problem through it.. Hopefully it will work for you https://github.com/Redth/PushSharp/issues/923 In addition to that follow- setting Load User Profile option as True in IIS worked for US. https://stackoverflow.com/questions/9951729/x509certificate-constructor-exception/10048789#10048789