Open avnerbarr opened 9 months ago
have you resolved that yet?Thks
Hi, I don't think the problem is authentication here. You received a 404, implying the endpoint wasn't found. Your websocket url has a fullstop .
at the end .
For future reference, all ws endpoints requiring any sort of authentication will take a listen key as an argument. E.g.
// get listen key
let client = BinanceHttpClient::default().credentials(self.exchange_credentials.clone());
let listen_key_response = client
.send(margin_stream::new_listen_key())
.await?
.into_body_str()
.await?;
let listen_key = serde_json::from_str::<ListenKeyResponse>(&listen_key_response)?;
// setup websocket
let (mut user_data_stream_connection, _) = BinanceWebSocketClient::connect_async_default()
.await
.expect("Failed to connect");
user_data_stream_connection
.subscribe(vec![&UserDataStream::new(&listen_key.listen_key).into()]) // <--- adding listen key here
.await;
I'm trying to use the Websocket version of the api but I don't see any place to put the credentials
There is a lot of unclarity in the docs and I don't see anything in the examples explaining or showing how this is done for the Websocket side.
here is a trivial snippet which leads to a crash when unwrapping the connection. The error isn't clear as to what the issue is