ios - using notnoop / java-apns to send message: message is Sent ... but I'm getting some error -
using notnoop / java-apns https://github.com/notnoop/java-apns i'm using code send message:
try { apnsservice service = apns .newservice() .withcert("mycertificates.p12", "xxxxxxxxxx").withproductiondestination().build(); string payload = apns.newpayload().alertbody(messageobject.msgtext) .sound("default").badge(1).build(); iterator<string> vitr = messageobject.addresses.iterator(); while (vitr.hasnext()) { string sent2token = (string) (vitr.next()); service.push(sent2token, payload); } service.stop(); } catch (networkioexception e) { system.out.println("client>> " + e.getmessage()); e.printstacktrace(); }
message sent fine, need red of output, because might slow program beside taking space .... please advice?
16:07:56.206 [thread-4140] info c.n.apns.internal.apnsconnectionimpl - exception while waiting error code java.net.socketexception: socket closed @ java.net.socketinputstream.socketread0(native method) ~[na:1.7.0_05] @ java.net.socketinputstream.read(socketinputstream.java:150) ~[na:1.7.0_05] @ java.net.socketinputstream.read(socketinputstream.java:121) ~[na:1.7.0_05] @ sun.security.ssl.inputrecord.readfully(inputrecord.java:312) ~[na:1.7.0_05] @ sun.security.ssl.inputrecord.read(inputrecord.java:350) ~[na:1.7.0_05] @ sun.security.ssl.sslsocketimpl.readrecord(sslsocketimpl.java:893) ~[na:1.7.0_05] @ sun.security.ssl.sslsocketimpl.readdatarecord(sslsocketimpl.java:850) ~[na:1.7.0_05] @ sun.security.ssl.appinputstream.read(appinputstream.java:102) ~[na:1.7.0_05] @ java.io.inputstream.read(inputstream.java:101) ~[na:1.7.0_05] @ com.notnoop.apns.internal.apnsconnectionimpl$1monitoringthread.run(apnsconnectionimpl.java:122) ~[server.jar:na]
to resurrect year old question:
until java-apns logged exception when connection apns service closed. should 2 things:
- use java-apns 1.0.0 beta2 (available on maven central) not log exception
- normally you'd keep built apnsservice around during runtime of server setting , closing down ssl connection little expensive. close if you're sure won't send connection long time. apnsservice mantains live connection apple's push server.
Comments
Post a Comment