apple / swift-nio-ssl

TLS Support for SwiftNIO, based on BoringSSL.
https://swiftpackageindex.com/apple/swift-nio-ssl/main/documentation/niossl
Apache License 2.0
385 stars 139 forks source link

How to be notified when SSL/TLS handshake is done #465

Closed xVanTuring closed 1 month ago

xVanTuring commented 1 month ago

I'm currently try to add NIOSSL(Client/Server)Handler dynamically, after received first custom identity data. I was able to use channel.pipeline.addHandler to do that, but I could find a way to get notified when the handshake is completed.

I noticed that in NIOHTTP1, we have a configureUpgradableHTTPClientPipeline extension function which will return a upgrade result. Can we provide something like that?

Lukasa commented 1 month ago

The NIOSSLHandler fires a user event down the channel pipeline when it completes the handshake: specifically, it fires one of these two depending on the outcome. You can see an example of how it is used in grpc-swift.