gpt4 book ai didi

node.js - Bitfinex 的 Websocket API "hello world"导致 ECONNREFUSED 错误

转载 作者:太空宇宙 更新时间:2023-11-04 02:14:03 32 4
gpt4 key购买 nike

Bitfinex's Websocket API有以下有关如何初始化连接的演示:

//using the ws library
var WebSocket = require('ws');
var w = new WebSocket("wss://api2.bitfinex.com:3000/ws");
w.onmessage = function(msg) {
console.log(msg.data);
};

使用 node.js 版本 v5.9.1ws 版本 1.0.1 运行该示例会导致以下错误:

events.js:154
throw er; // Unhandled 'error' event
^

Error: connect ECONNREFUSED 178.249.189.15:3000
at Object.exports._errnoException (util.js:890:11)
at exports._exceptionWithHostPort (util.js:913:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1061:14)

该错误的原因是什么?

最佳答案

服务器拒绝连接...可能是端口 (:3000) 或主机名。版本 2 的当前主机是 api.bitfinex.com - 我使用的完整网址是:wss://api.bitfinex.com/ws/2 截至(2017 年 7 月 11 日)

关于node.js - Bitfinex 的 Websocket API "hello world"导致 ECONNREFUSED 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36576012/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com