apns icon indicating copy to clipboard operation
apns copied to clipboard

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

Open grosch opened this issue 6 years ago • 17 comments

The http2 library seems to be ready to use.

grosch avatar Jun 26 '18 14:06 grosch

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.

anthonycastelli avatar Jun 26 '18 22:06 anthonycastelli

Any news?

MihaelIsaev avatar Sep 26 '18 09:09 MihaelIsaev

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

anthonycastelli avatar Sep 26 '18 17:09 anthonycastelli

@anthonycastelli FWIW,

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

kylebrowning avatar Nov 14 '18 20:11 kylebrowning

Sounds like we may not need Vapor to be http2

kylebrowning avatar Nov 14 '18 20:11 kylebrowning

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

kylebrowning avatar Jan 09 '19 21:01 kylebrowning

@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 avatar Jan 09 '19 22:01 tanner0101

@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 avatar Jan 09 '19 22:01 kylebrowning

@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 avatar Jan 09 '19 23:01 kylebrowning

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

tanner0101 avatar Jan 10 '19 00:01 tanner0101

https://github.com/ethanhuang13/CupertinoJWT

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

kylebrowning avatar Jan 10 '19 04:01 kylebrowning

this does it without any deps

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

vzsg avatar Jan 10 '19 12:01 vzsg

Doh. Thanks.

kylebrowning avatar Jan 10 '19 15:01 kylebrowning

@vzsg does using SecKeyCreateWithData and SecKeyCreateSignature work with linux?

kylebrowning avatar Jan 10 '19 18:01 kylebrowning

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

tanner0101 avatar Jan 10 '19 18:01 tanner0101

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 avatar Jan 11 '19 16:01 kylebrowning

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

kylebrowning avatar Mar 25 '19 21:03 kylebrowning