XRPLF / xrpl.js

A JavaScript/TypeScript API for interacting with the XRP Ledger in Node.js and the browser
https://xrpl.org/
1.2k stars 511 forks source link

[NotConnectedError(Expected HTTP 101 response but was '418 ', { isTrusted: false, message: [Getter/Setter] })] #2747

Closed divyangkhatri closed 1 month ago

divyangkhatri commented 1 month ago

Version details

 "react-native": "^0.72.7",
"xrpl": "^2.14.0",

I am using rn-nodeify for compatibility of node js in react-native

I am facing very strange issue in android, This is only android specific issues in iOS it is working fine

   import {Client} from 'xrpl';
   const rippleProvider = new Client('wss://xrplcluster.com');
   await rippleProvider.connect();
   const balances = await rippleProvider.getBalances(address);

when i try to fetch the balance from above code, I am getting following error

[NotConnectedError(Expected HTTP 101 response but was '418 ', { isTrusted: false, message: [Getter/Setter] })]
justinr1234 commented 1 month ago

@divyangkhatri we don't typically support this environment you've mentioned, I might suggest upgrading to the latest version of xrpl.js

Have you also checked your permissions in the android manifest?

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Our bundled version of websockets may not be compatible with your environment. In that case, you can try modifying the code by swapping our version of websockets code with something that will work in your environment. Unfortunately that's a bit beyond explaining, you'll need to look at the xrpl.js code and try to work through it (maybe ChatGPT can help a bit there). I'd also invite you to join the Discord for more help. https://discord.com/servers/xrp-ledger-developers-886050993802985492

You might also try using JSON-RPC (HTTPS) on android instead of websockets. https://xrplcluster.com/

Or try https://xrpl.org/docs/tutorials/public-servers/