Reputation: 872
I am persistently getting following error on connecting to test server using 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.)]
However, if I try to get balance from curl, it works:
curl 'https://testnet.data.api.ripple.com/v2/accounts/rwAVpkGNU9Shn63EpFq7ju1tr89SsSBwHz/balances?currency=XRP'
Code snippet below:
'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);
Upvotes: 1
Views: 795
Reputation: 305
timeout param doesn't seem to work even if I suggest;
use:
api.connection._config.connectionTimeout = 3e4;
Upvotes: 1