boostcode / Tori-APNS

Tori APNS adds support to Kitura to send easily Apple Push Notification using HTTP/2
21 stars 3 forks source link

payload error #7

Open carlhung opened 7 years ago

carlhung commented 7 years ago

Hey, sorry to disturb you. I installed swift complier of version 3.1.1 on Ubuntu in order to run the code. certificate is good although I found some problem. also, installed http2, etc. all the components I need. now, I can successfully use the certificate. but I encountered another error message from curl.

there is the code I used: // the token is work, i used other application to test the token. let token = "8fcf2f3a21102db657da053870781bb4164bce650ab8afd77de24ce52f796848" let push = APNS(withCerts: APNSCertificate(certPath: "/home/carl/swift/time/pem/crt.pem", keyPath: "/home/carl/swift/time/pem/key.pem ) ) let payload = APNSPayload(withText: "Test") push.send(payload: payload, to: token)

I got following error:

< HTTP/2.0 200 HTTP/2.0 200 < apns-id:F6303094-AA99-B6EF-D603-03A751EB391C apns-id:F6303094-AA99-B6EF-D603-03A751EB391C

<

------------------------------the error message can be different, some time:----------------------- ... Content-Length: 0

< HTTP/2.0 400 HTTP/2.0 400 < apns-id:0D66D5A3-2909-D13A-F1DD-0F9234DA883F apns-id:0D66D5A3-2909-D13A-F1DD-0F9234DA883F

-------------------------------------sometime:--------------------------------------------------- Content-Length: 3

< HTTP/2.0 200 HTTP/2.0 200 < apns-id:9C2EC37B-4DEF-ACFF-3C20-A3C491C6A3BC apns-id:9C2EC37B-4DEF-ACFF-3C20-A3C491C6A3BC

<

matteocrippa commented 7 years ago

@carlhung thank you for your feedback I fixed documentation first to remove double dots inside name file issue ( https://github.com/boostcode/Tori-APNS/blob/master/README.md ).

When it raises Connection #0 as far as I remember it means that it works fine, but I think the issue is with PUSH UUID format, try to remove the minus inside

carlhung commented 7 years ago

the UUID I didn't provide. as I read the document from Apple. apns-id can be ignored. and apple apn server will provide one. the UUID above was returned by apple. and I also tried to modify the payload format as I saw "{"reason":"PayloadEmpty"}", still couldn't make it.

matteocrippa commented 7 years ago

let's try to debug in this way: are certificates for development env?

carlhung commented 7 years ago

yes, for development.

carlhung commented 7 years ago

I googled about this error, some said it is because of the version of curl. but i tried to install few version i still couldn't make it run. there is a new module for vopar, it calls vapor-apns deriving from your repositories. I read from the package.swift in the module. and I also saw you fork CCurl from IBM and modified. I am thinking if it is because of the curl that you are using? as I am using the IBM one. should i add ccurl from your git to my package.swift? but i checked again, that your ccurl and the IBM's ccurl the only different is in Package.swift: .Brew("curl --with-openssl --with-nghttp2"), // yours .Brew("curl"), // IBM's

thanks.

matteocrippa commented 7 years ago

Yep at that time it was needed to force the http2 protocol to add that tweak

carlhung commented 7 years ago

but the project i am already using IBM's. but how can I change to use yours? as KITURA's so many modules IBM's CCurl.

matteocrippa commented 7 years ago

It is a still pending issue that one swift package manager, it force you to use only library, you can't use more than one. Probably they managed to upgrade the lib and now it is not compatible, I should have to test it, but in those day I have no spare time to

carlhung commented 7 years ago

anyway, thanks.