我正在尝试使用套接字io连接到数据流。
- 我已经尝试更改套接字io版本。我不知道服务器使用的确切版本。如何获得连接到此服务器所需的正确版本?
我得到的是一个错误:
---------------------------------------------------------------------------
ConnectionError Traceback (most recent call last)
<ipython-input-4-9173c0d3bafc> in <module>
4 sio = socketio.Client()
5
----> 6 sio.connect(socketEndpoint, transports = 'websocket')
7 sio.emit('join', { 'channelName': 'B-BTC_USDT' })
8
c:usersz00451nhappdatalocalprogramspythonpython38libsite-packagessocketioclient.py in connect(self, url, headers, transports, namespaces, socketio_path)
280 except engineio.exceptions.ConnectionError as exc:
281 self._trigger_event(
--> 282 'connect_error', '/',
283 exc.args[1] if len(exc.args) > 1 else exc.args[0])
284 raise exceptions.ConnectionError(exc.args[0]) from None
c:usersz00451nhappdatalocalprogramspythonpython38libsite-packagessix.py in raise_from(value, from_value)
ConnectionError: Connection error
I tried with
- python-socketio 5.0.4 &python- engineeio 4.0.0(默认安装版本)
- python-socketio 4.6 &python-engineio 3.14.2代码:
import socketio
socketEndpoint = 'wss://stream.coindcx.com'
sio = socketio.Client()
sio.connect(socketEndpoint, transports = 'websocket')
sio.emit('join', { 'channelName': 'B-BTC_USDT' })
@sio.on('B-BTC_USDT')
def on_message(response):
print(response.data)
好像服务器坏了查看这里https://www.websocket.org/echo.html