-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ClientBuilder
panics with "Status code must be Switching Protocols"
#160
Comments
I managed to get it to work with this code: let mut client = ClientBuilder::new(url)
.unwrap()
.connect(None)
.unwrap(); ref: https://github.com/nstoddard/websocket-client/blob/master/src/lib.rs |
Same issue as @mitchmindtree here. The solution proposed by @agyx does not work. |
In my case, there were two mistakes on my end:
After fixing this, it works as expected! Edit: using |
|
I tried to do it with let url = format!("wss://{}/live/{}?profile=owner", &client.backend, &file.unwrap().id);
let mut headers = Headers::new();
headers.set(Cookie(vec![client.auth_cookie.clone().unwrap()]));
let tls = TlsConnector::builder()
.danger_accept_invalid_certs(client.insecure)
.build()
.unwrap();
debug!("connecting to {}", url);
let mut ws = ClientBuilder::new(url.as_str())
.unwrap()
.add_protocol("binary")
.custom_headers(&headers)
.connect(Some(tls))
.unwrap();
debug!("successfully connected");
The exact same code works with the same server code but with a "secured" connection (not self-signed certificates and |
@vi any idea of how we could solve this? Thank you for your help. |
@promethe42 Is the problem really client-side, not server-side? Can it be reproduced with |
@vi since the exact same server code works when the SSL checks are enabled then I would say yes: the problem appears to be client side. I'll try to get a dump to confirm it. |
Is there any update? I have the same problem. |
Any update on this? |
I'm currently attempting to use rust-websocket to connect to btcmarkets' websocket, however when building a rust-websocket client I get
This is is the rust code I have for attempting to connect to the btcmarkets websocket:
I've tried adding "rust-websocket" and "websocket" protocols but the same error occurs. That said I don't really know what I'm doing with the
add_protocol
method or how protocols are used by websockets (this is my first time programatically connecting to a websocket).I tried the example node.js code provided by btcmarkets and it seems to work fine - here's that code:
If you could offer any advice on the cause of this error and how I might work around it that would be greatly appreciated!
The text was updated successfully, but these errors were encountered: