java-apns
java-apns copied to clipboard
Getting Connection Resets from apns server
My application needs to push notifications to ios devices. I used Notoop java-apns 0.2.2 as java client for pushing notification.
I frequently get these errors in my log logged by monitorSocket thread.
2018-09-07 15:41:57.379 c.n.a.i.ApnsConnectionImpl [INFO] Exception while waiting for error code
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:210) ~[?:1.8.0_131]
at java.net.SocketInputStream.read(SocketInputStream.java:141) ~[?:1.8.0_131]
at sun.security.ssl.InputRecord.readFully(InputRecord.java:465) ~[?:1.8.0_131]
at sun.security.ssl.InputRecord.read(InputRecord.java:503) ~[?:1.8.0_131]
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973) ~[?:1.8.0_131]
at sun.security.ssl.SSLSocketImpl.readDataRecord(SSLSocketImpl.java:930) ~[?:1.8.0_131]
at sun.security.ssl.AppInputStream.read(AppInputStream.java:105) ~[?:1.8.0_131]
at java.io.InputStream.read(InputStream.java:101) ~[?:1.8.0_131]
at com.notnoop.apns.internal.ApnsConnectionImpl$1MonitoringThread.run(ApnsConnectionImpl.java:114) [apns-0.2.2.jar:?]
I understand, This error is generated by MonitoringThread which listens on socket input stream for errors.( Apple only provides a response for error messages and then it closes the connection). In my case , the connection gets reset before any response code is received and due to this , the client creates a new socket connection with apns server, but the sent message is lost.
What could be the possible reasons that apns server is resetting connection without sending any error codes? Many of my messages are getting lost this way.
Any updates on this issue? Would you share any solution to this?
@airobot60 It seems your APNS certificate is either expired or there's something wrong with how it's been generated.