Open devanlai opened 2 days ago
I wanted to add get_mut()
anyways seeing how more advanced usecases like setting socket options post-connect are enabled by it. It will definitely need a note that writing and reading from the I/O should never be done.
Currently there's not a convenient way to get a shared reference to the underlying stream from a
WebSocketStream<S>
. I could useBuilder::connect_on()
to connect to an established stream that I've already prepared, but as far as I can tell, there's not a clean way to letconnect()
establish the stream for me and get a reference to it.In my use case, I'd like to be able to inspect the underlying
MaybeTlsStream<T>
that's internally insideWebSocketStream<S>
. That way I can inspect the peer certificates and other TLS connection properties to verify certain security properties and log them.tokio-tungstenite
provides aWebSocketStream::get_ref()
method that provides a shared reference to the underlying stream.It also provides a
get_mut()
method to get a mutable reference, but that seems a little dangerous.