【问题标题】:How to resolve Ripple test server connection error?如何解决 Ripple 测试服务器连接错误?
【发布时间】:2020-05-18 12:30:56
【问题描述】:

我在使用 RippleAPI for Javascript 连接到测试服务器时不断收到以下错误:

[ConnectionError(Error: connect() timed out after 2000 ms. If your internet connection is working, the rippled server may be blocked or inaccessible.)]

但是,如果我尝试从 curl 中获得平衡,它会起作用:

curl 'https://testnet.data.api.ripple.com/v2/accounts/rwAVpkGNU9Shn63EpFq7ju1tr89SsSBwHz/balances?currency=XRP'

下面的代码sn-p:

'use strict';
const RippleAPI = require('ripple-lib').RippleAPI;

const api = new RippleAPI({
  server: 'wss://s.altnet.rippletest.net:51233' // Public rippled server
});
api.connect().then(() => {
  /* begin custom code ------------------------------------ */
  const myAddress = 'rwAVpkGNU9Shn63EpFq7ju1tr89SsSBwHz';

  console.log('getting account info for', myAddress);
  return api.getAccountInfo(myAddress);

}).then(info => {
  console.log(info);
  console.log('getAccountInfo done');

  /* end custom code -------------------------------------- */
}).then(() => {
  return api.disconnect();
}).then(() => {
  console.log('done and disconnected.');
}).catch(console.error);

【问题讨论】:

  • 您找到解决方案了吗?我也面临同样的问题。

标签: javascript ripple cryptocurrency


【解决方案1】:

即使我建议超时参数似乎也不起作用;

使用: api.connection._config.connectionTimeout = 3e4;

【讨论】:

    猜你喜欢
    • 2020-05-07
    • 1970-01-01
    • 1970-01-01
    • 2019-04-12
    • 2020-01-21
    • 1970-01-01
    • 2019-07-04
    • 1970-01-01
    • 2017-09-29
    相关资源
    最近更新 更多