snapview / tokio-tungstenite

Future-based Tungstenite for Tokio. Lightweight stream-based WebSocket implementation
MIT License
1.88k stars 236 forks source link

`MaybeTlsStream` as a separate crate. #349

Open jakoschiko opened 2 months ago

jakoschiko commented 2 months ago

The type tokio_tungstenite::MaybeTlsStream looks very useful. Any interest in moving it to a separate crate?

I'm currently trying to add optional TLS support for an IMAP library and need exactly that, an enum that implements AsyncRead and AsyncWrite. But I don't want to manage dependency updates of rustls and native-tls myself. If I could simply point the users of my library to a separate crate it would be very helpful.

Maybe related to #285

jakoschiko commented 2 months ago

Just to be clear: I don't want to maintain such a type only for my own project. I'm happy to help maintaining it in a shared project.

daniel-abramov commented 2 months ago

Yeah, IIRC we were asked about this a couple of times within the past years.

I wonder if there is already a similar, more generic alternative. I did not have plans to create a new crate just for MaybeTlsStream, but if someone makes such a crate, we'd be happy to switch to it to spare some boilerplate code. I did not check how other similar crates manage this kind of thing.

jakoschiko commented 2 months ago

Okay, I'll investigate it. Eventually I'll create a crate and inform you.