Binance Websocket API卡在打开消息上
我有这个...
import websocket
SOCKET = "wss://stream.binance.com:9443/ws/ADABUSB@nav_kline_1m"
def on_open(ws):
print('opened connection')
def on_close(ws):
print('close connection')
def on_message(ws, message):
print('received message')
print(message)
ws = websocket.WebSocketApp(SOCKET, on_open = on_open, on_close = on_close, on_message = on_message)
ws.run_forever()
当我运行它时,它会粘在打开的连接上,然后什么也不做? 有什么想法吗?
没有错误消息,我把它放了几分钟!
干杯 Zak
I have this...
import websocket
SOCKET = "wss://stream.binance.com:9443/ws/ADABUSB@nav_kline_1m"
def on_open(ws):
print('opened connection')
def on_close(ws):
print('close connection')
def on_message(ws, message):
print('received message')
print(message)
ws = websocket.WebSocketApp(SOCKET, on_open = on_open, on_close = on_close, on_message = on_message)
ws.run_forever()
When I run it it sticks on OPENED CONNECTION and then does nothing??
Any ideas?
No error messages and I have left it for minutes!!
Cheers
Zak
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您如何知道,您尚未定义
on_error
-callback :)?尝试像下面的那样添加它,看看它是否有所不同(在我的末尾确实如此):
How do you know, you haven't defined the
on_error
-callback :) ?Try adding it like below and see if it makes a difference (it does on my end):
找到了这个,它起作用了!
我在Mac上...
点!从 /etc /主机及其连接中删除:: 1。 Localhost决心:: 1。感谢您的帮助。
Found this and it worked!
I am on a Mac...
Spot on! removed ::1 from /etc/hosts and its connecting. localhost was resolving to ::1. Thanks for help.