vapor-community / apns

Vapor APNS for iOS
60 stars 2 forks source link

https://github.com/apple/swift-nio-http2 #1

Closed grosch closed 5 months ago

grosch commented 6 years ago

The http2 library seems to be ready to use.

anthonycastelli commented 6 years 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.

MihaelIsaev commented 6 years ago

Any news?

anthonycastelli commented 6 years ago

Nothing yet. The moment it does get support for HTTP/2 I'll be able to implement this.

kylebrowning commented 5 years ago

@anthonycastelli FWIW,

https://github.com/vapor/vapor/issues/1650#issuecomment-438802428

kylebrowning commented 5 years ago

Sounds like we may not need Vapor to be http2

kylebrowning commented 5 years ago

FWIW, I've got this working with Swift NIO HTTP2 directly as suggested.

tanner0101 commented 5 years ago

@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

kylebrowning commented 5 years ago

@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.

kylebrowning commented 5 years ago

@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.

tanner0101 commented 5 years ago

@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.

kylebrowning commented 5 years ago

https://github.com/ethanhuang13/CupertinoJWT

@tanner0101 this does it without any deps. May integrate the same way.

vzsg commented 5 years ago

this does it without any deps

Wrong. It depends on the CommonCrypto framework, which is not available on Linux.

kylebrowning commented 5 years ago

Doh. Thanks.

kylebrowning commented 5 years ago

@vzsg does using SecKeyCreateWithData and SecKeyCreateSignature work with linux?

tanner0101 commented 5 years ago

@kylebrowning I think that's part of the Security module (Sec... prefix) which is not available on Linux.

kylebrowning commented 5 years ago

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.

kylebrowning commented 5 years ago

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