fix(api): market/combined_streams: Get Proxy form Environment (#879)

* fix(api): market/combined_streams: Get Proxy form Environment

issues:
 批量订阅流失败: 组合流WebSocket连接失败: dial tcp xxxxxx:443: i/o timeout

Make environment variables effective for
dialer.Dial("wss://fstream.binance.com/stream", nil):

export HTTPS_PROXY=http://ip:port
export HTTP_PROXY=http://ip:port

Signed-off-by: MarsDoge <mars@dogexorg.com>

* docs(WebSocket): add proxy usage guidance for combined streams (#475)

Signed-off-by: MarsDoge <mars@dogexorg.com>

---------

Signed-off-by: MarsDoge <mars@dogexorg.com>
This commit is contained in:
Dongyan Qian
2025-11-13 20:29:51 +08:00
committed by tangmengqiu
parent 9fc1870f5f
commit e0af0d96e0
3 changed files with 38 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ import (
"strings"
"sync"
"time"
"net/http"
"github.com/gorilla/websocket"
)
@@ -32,6 +33,7 @@ func NewCombinedStreamsClient(batchSize int) *CombinedStreamsClient {
func (c *CombinedStreamsClient) Connect() error {
dialer := websocket.Dialer{
HandshakeTimeout: 10 * time.Second,
Proxy : http.ProxyFromEnvironment,
}
// 组合流使用不同的端点