Closed matao403 closed 8 years ago
I think that connection was closed. It can happen because of problems to a network or if invalid token is sent or other reasons.
error == nil in some cases is known bug.
You can use pre version 2.0.0 (https://github.com/adobkin/libcapn/tree/experimental). In version 2.0.0 errors has been more information and you can set log function https://github.com/adobkin/libcapn/tree/experimental#logging. Also this version has function apn_send2(). This function automatically establishes new connection to APNs when connection is dropped. The function establishes new connection to APNs only when invalid token has been sent, otherwise new connection will not be established.
But version 2.0.0 isn't compatible to version 1.0.x
Model of errors-handling was changed in version 2.0.0. New version is more talkative. You can specify logging level and logging callback to receive errors and/or debug info
I use libcapn to create secure connection with APNS. All push notifications will re-use this connection as apple suggested. But, I find the first 'apn_send' will be failed. apn_error shows failed, but error is null. If we close the connection and create the connection again, 'apn_send' will be success. Otherwise, we cannot send push notification again. Is there anyone has this issue as well? Where is wrong?
apn_error = apn_send(sipdev_apn_ctx, payload_ctx, &error);