-
Notifications
You must be signed in to change notification settings - Fork 297
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
websocket receive MarketData error #123
Comments
I used vpn |
@Ultraman95 It sounds like it could be solved by adding Proxy support to this crate. |
@wisespace-io I had this issue too, until I got rid of the port number from the URL in my script. Need a quick fix? |
@siegfried It is weird. The port is part of the url as stated in the Binance docs. Have you tried to overwrite it? See https://github.com/wisespace-io/binance-rs#testnet-and-api-clusters. All URLs can be overwritten with a custom config.
See where it happens, https://github.com/wisespace-io/binance-rs/blob/master/src/websockets.rs#L23 |
Thanks. I haven't tried this crate. Great work. Will do soon. This just reminded me the issue I had in my script a few weeks ago. I just checked the document, it seems they added the port number back. |
@wisespace-io The issue still exists. I got this error by running the example. use binance::websockets::*;
use std::sync::atomic::{AtomicBool};
fn main() {
let keep_running = AtomicBool::new(true); // Used to control the event loop
let kline: String = format!("{}", "ethbtc@kline_1m");
let mut web_socket: WebSockets = WebSockets::new(|event: WebsocketEvent| {
match event {
WebsocketEvent::Kline(kline_event) => {
println!("Symbol: {}, high: {}, low: {}", kline_event.kline.symbol, kline_event.kline.low, kline_event.kline.high);
},
_ => (),
};
Ok(())
});
web_socket.connect(&kline).unwrap(); // check error
if let Err(e) = web_socket.event_loop(&keep_running) {
match e {
err => {
println!("Error: {:?}", err);
}
}
}
web_socket.disconnect().unwrap();
}
After remove the port number, it works. use binance::websockets::{
WebSockets,
WebsocketEvent
};
use binance::config::Config;
use std::sync::atomic::{AtomicBool};
fn main() {
let config = Config::default().set_ws_endpoint("wss://stream.binance.com/ws");
let keep_running = AtomicBool::new(true); // Used to control the event loop
let kline: String = format!("{}", "ethbtc@kline_1m");
let mut web_socket: WebSockets = WebSockets::new(|event: WebsocketEvent| {
match event {
WebsocketEvent::Kline(kline_event) => {
println!("Symbol: {}, high: {}, low: {}", kline_event.kline.symbol, kline_event.kline.low, kline_event.kline.high);
},
_ => (),
};
Ok(())
});
web_socket.connect_with_config(&kline, &config).unwrap(); // check error
if let Err(e) = web_socket.event_loop(&keep_running) {
match e {
err => {
println!("Error: {:?}", err);
}
}
}
web_socket.disconnect().unwrap();
} I can help on changing the default and do some refactor if you need. |
@siegfried All binance libraries use the default port. As this crate gives the possibility of overwrite the url, wouldn't be enough?
Maybe we just need to add the example to the README in case someone else has problems with the default port. It seems more an issue with your connection. Check similar issue in ratchetphp/Pawl#100 |
I will add support to Proxy, it may also help. |
Add the example to the README is fine, I think. Thanks. |
@wisespace-io There is no config option for |
thread 'main' panicked at 'called
Result::unwrap()
on anErr
value: Error(Msg("Error during handshake URL error: Unable to connect to wss://stream.binance.com:9443/stream?streams=ethbtc@depth@100ms/bnbeth@depth@100ms"), State { next_error: None, backtrace: InternalBacktrace })'Rust Version 1.53
The text was updated successfully, but these errors were encountered: