najamelan / ws_stream_tungstenite

Provide AsyncRead/AsyncWrite over tungstenite websockets
31 stars 16 forks source link

Connecting to wss:// like addresses... #1

Closed serzhiio closed 2 years ago

serzhiio commented 5 years ago

Could you show an example of how to connect to wss:// like addresses. As example wss://site.com/ws/v2/

najamelan commented 5 years ago

I will try to make an example. ws_stream_tungstenite doesn't deal with the actual connection. You have to connect using tokio-tls, tokio-tungstenite and pass the WebSocketStream to WsStream::new.

Know that in order to test an example a TLS connection locally, you will have to set it up TLS certificates correctly or use an API that skips verification. You can have a look the examples for tokio-tls.

Note that currently tokio-tungstenite still uses tokio 0.1, but as soon as they switch to 0.2 (work is well under way), I will update ws_stream_tungstenite. Until then I will keep the alpha versioning.

najamelan commented 2 years ago

Im actually going to close this, since it really doesn't belong here. All this crate does is implementing AsyncRead/AsyncWrite on an existing websocket connection, so instructions for wss should be in the tungstenite or the async-tungstenite crate.