-
Notifications
You must be signed in to change notification settings - Fork 43
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
Unable to Establish Connection with `BinanceWebSocketClient::connect_async #25
Comments
Supplementary Information: package main
import (
"log"
"github.com/gorilla/websocket"
)
func main() {
// WebSocket服务器地址
url := "wss://stream.binance.com:443/ws/btcusdt@miniTicker"
// 连接WebSocket服务器
c, _, err := websocket.DefaultDialer.Dial(url, nil)
if err != nil {
log.Fatal("连接失败:", err)
}
defer c.Close()
done := make(chan struct{})
// 处理接收消息
defer close(done)
for i := 0; i < 10; i++ {
_, message, err := c.ReadMessage()
if err != nil {
log.Println("读取消息错误:", err)
return
}
log.Printf("收到消息: %s", message)
}
} Observation:
Comparison with Rust:
Request: |
I am facing an issue with a simple Rust program using the use tungstenite::{connect, Message};
use url::Url;
fn main() {
// WebSocket server address
let url = "wss://stream.binance.com:443/ws/btcusdt@miniTicker";
// Connect to the WebSocket server
let (mut socket, response) = connect(Url::parse(url).unwrap()).expect("Connection failed");
println!(
"Connection successful, HTTP status code: {}",
response.status()
);
// Receive and print messages
for _ in 0..10 {
let msg = socket.read().expect("Failed to read message");
match msg {
Message::Text(text) => {
println!("Received message: {}", text);
}
Message::Ping(ping) => {
println!("Received Ping: {:?}", ping);
// Respond with Pong
socket
.send(Message::Pong(ping))
.expect("Failed to send Pong");
}
Message::Close(frame) => {
println!("Connection closed: {:?}", frame);
break;
}
_ => (),
}
}
// Close the connection
socket.close(None).expect("Failed to close connection");
} Observation:
Expected Behavior: Actual Behavior: Environment:
Relevant [dependencies]
tungstenite = { version = "0.24", features = ["native-tls", "url"] }
url = "2.5" Additional Information:
Request: |
example/tokio_tungstenite.rs
I am facing an issue with the
binance_spot_connector_rust
library where the WebSocket connection attempt times out without any response. When executing the following code:the connection hangs and eventually results in a timeout error.
Steps to Reproduce:
binance_spot_connector_rust
crate to create a WebSocket connection to Binance.wss://stream.binance.com:9443/ws/btcusdt@miniTicker
.connect_async
.Expected Behavior:
The connection should be established successfully and proceed to receive messages from the WebSocket stream.
Actual Behavior:
The connection hangs indefinitely without any response, and after a while, a timeout error occurs.
Environment:
binance_spot_connector_rust
version: [Insert version]Additional Information:
I would appreciate any guidance on why the connection might be timing out and suggestions for potential fixes. Thank you!
The text was updated successfully, but these errors were encountered: