const WebSocket = require('ws');
const ws = new WebSocket('wss://stream.binance.com:9443/ws/btcusdt@trade');
ws.on('message', function incoming(data) {
console.log(data);
});
字符串
这是我的代码,当我运行这个给定的错误
node:events:493
throw er; // Unhandled 'error' event
^
Error: write EPROTO 885B0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:c:\ws\deps\openssl\openssl\ssl\record\ssl3_record.c:355:
at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16)
Emitted 'error' event on WebSocket instance at:
at emitErrorAndClose (C:\Users\uchun\node_modules\ws\lib\websocket.js:1033:13)
at ClientRequest.<anonymous> (C:\Users\uchun\node_modules\ws\lib\websocket.js:880:5)
at ClientRequest.emit (node:events:515:28)
at TLSSocket.socketErrorListener (node:_http_client:495:9)
at TLSSocket.emit (node:events:515:28)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -4046,
code: 'EPROTO',
syscall: 'write'
}
Node.js v21.1.0
型
我尝试了一切,但没有结果。
1条答案
按热度按时间dzjeubhm1#
首先更新WebSocket并尝试以下操作:
字符串