Closed grosch closed 5 months ago
Right, it is available, however, Vapor needs to app support for it before this library can take advantage of it. Tanner did mention that once Fluent is released, he was going to looking into this.
Any news?
Nothing yet. The moment it does get support for HTTP/2 I'll be able to implement this.
@anthonycastelli FWIW,
https://github.com/vapor/vapor/issues/1650#issuecomment-438802428
Sounds like we may not need Vapor to be http2
FWIW, I've got this working with Swift NIO HTTP2 directly as suggested.
@kylebrowning is that work open source? If so, you should consider submitting it to the Swift Server Work Group. :) https://forums.swift.org/c/server/pitches
@tanner0101 I don't mind open sourcing it, im just working on the JSON Web Token stuff and trying to use as little dependencies as possible, if any at all.
@tanner0101 alas ive come full circle to this, https://github.com/vapor/crypto/issues/73
Ill try to get it working myself without deps, but its been a whirlwind.
@kylebrowning I agree, it would be great if the APNS package did not need to depend on vapor/crypto
. It looks like @anthonycastelli used OpenSSL's ECDSA implementation in the current version of this APNS package. If you are OK with adding OpenSSL as a dependency, you could consider a similar approach to what vapor/crypto does with its CCryptoOpenSSL
module. (See Package.swift
and Sources/CCryptoOpenSSL
).
You could also just import CNIOOpenSSL
, but that is not recommended since it's technically a private module and NIO may be moving to BoringSSL in the future. It's a better idea to create your own C...OpenSSL
module so you have control. Hopefully a good, unified solution to Crypto will be proposed soon. But, until then, wrapping OpenSSL privately is probably the best option.
https://github.com/ethanhuang13/CupertinoJWT
@tanner0101 this does it without any deps. May integrate the same way.
this does it without any deps
Wrong. It depends on the CommonCrypto framework, which is not available on Linux.
Doh. Thanks.
@vzsg does using SecKeyCreateWithData
and SecKeyCreateSignature
work with linux?
@kylebrowning I think that's part of the Security
module (Sec...
prefix) which is not available on Linux.
Okay so last night I got this working over here, https://github.com/moritzsternemann/nio-apns/tree/kyle-develop
It only depends on OpenSSL. The other NIOH2 package it is importing is simply an HTTP2 client.
Relevant code is here and here
So the question remains now. Do we want to require an HTTP2 NIO client like the one Ive just required and submitted a pr to?
Tanner suggested we work on the pitch to server working group for a standardized HTTP1/2 client but with my open source experience I know that will take some time.
I slightly like the architecture/structure of the other apns library so Im inclined to go work over there especially since it is not dependent on vapor.
Im more inclined to build a Push Notification vapor library that allows Android or iOS devices to pub sub and stores all that inside of vapor. Then vapor just calls the NIO HTTP2 to push notifications.
Im going to start that route and just leave the shared code here for others if they want to go different ways
Once the standard HTTP1/2 client is finished, then we can port to that and drop the support for the custom HTTP2 client.
FYI. Ive moved this work over to, https://github.com/kylebrowning/swift-nio-http2-apns and submitted a pitch here. https://forums.swift.org/t/apple-push-notification-service-implementation-pitch/20193
The http2 library seems to be ready to use.