我用RESTful的API是可以正常运行的,但是我想尝试使用websocket接口,我尝试了官方github的示例:import time
import logging
from binance.lib.utils import config_logging
from binance.um_futures import UMFutures
from binance.websocket.um_futures.websocket_client import UMFuturesWebsocketClient
config_logging(logging, logging.DEBUG)
def message_handler(message):
print(message)
my_client = UMFuturesWebsocketClient()
my_client.start()
my_client.book_ticker(
symbol=“bnbusdt”,
id=13,
callback=message_handler,
)
#my_client.instant_subscribe(
stream=[‘bnbusdt@bookTicker’, ‘ethusdt@bookTicker’],
callback=message_handler,
#)
time.sleep(5)
logging.debug(“closing ws connection”)
my_client.stop()
可是运行后返回的结果是一直连接不上:2023-05-04 21:33:33.380 UTC INFO binance.websocket.binance_client_factory: Start to connect…
2023-05-04 21:33:33.423 UTC INFO binance.websocket.binance_client_factory: Start to connect…
2023-05-04 21:33:38.403 UTC DEBUG root: closing ws connection
请教下大神们,这是什么原因呢?如果是VPN问题,那为什么用其他接口运行又正常?