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

@@ -1285,6 +1285,24 @@ sudo apt-get install libta-lib0-dev
- If API fails, system uses default mainstream coins (BTC, ETH, etc.)
- ~~Check API URL and auth parameter in config.json~~ *Check configuration in web interface*
### 6. WebSocket can't connect when using an HTTP/HTTPS proxy
**Solution**:
- Export standard proxy environment variables *before* starting the backend:
```bash
export HTTPS_PROXY=http://<proxy-host>:<port>
export HTTP_PROXY=http://<proxy-host>:<port>
# If your proxy requires credentials
export HTTPS_PROXY=http://user:pass@<proxy-host>:<port>
export HTTP_PROXY=http://user:pass@<proxy-host>:<port>
# Start NOFX normally
./start.sh
```
- **Docker Compose**: put the variables in `.env` or the service's `environment` block.
- NOFX relies on Go's `http.ProxyFromEnvironment`, so every outbound request—including the Binance combined streams WebSocket—follows these proxy settings automatically when the variables are present.
---
## 📈 Performance Optimization Tips