-
Notifications
You must be signed in to change notification settings - Fork 500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XrplError: Websocket connection never cleaned up. using xrpl version 2.7.0 and node version 18.16.0. #2323
Comments
You don’t appear to be awaiting the call to getAllCurrencies |
No @justinr1234 Actually that also i have done. As I have used getAllCurrencies(ac) in other module as it is like helper method. You can see i have use await also.
And also i made client.connect() in getAllCurrencies(ac) and at end client.Disconnect() now i am getting another error i.e. The updated code of this method getAllCurrencies(ac) is below:- async function getAllCurrencies(ac) { So can you guess what actually is issued.? |
Are you in a browser environment? If so, I believe we have a fix for this error message that hasn’t been released yet. Edit: I don’t think there’s fix for it. But this was fixed in 2.7.0 originally for browser environments. |
Actually @justinr1234 I have upgraded to XRPL version 2.7.0 at backend i.e. nodejs . I haven't used this NPM in frontend i.e. reactjs. Earlier i was using XRPL version 2.6.0 to getBalance() of an account but for few account i got INVALID_PARAMS and then as per the suggestion i used this method to get XRPL balance i.e. account_lines and account_info and also updated XRPL to 2.7.0 at backend environment. |
@KumarUjjwal2022 would you be able to share your code with me? It would be easier to look at the failing code. |
Is also recommend wrapping all your awaits in a try catch block to see if you can figure out other errors happening. Did you verify each step of the way that the functions were completing successfully? |
@justinr1234 We already have try catch in method where we are using this helper method i.e. and that catch block gives the above mentioned error , my code is :- try {
|
Would you be able to invite me to your code so I can take a look? |
Okay @justinr1234 Do we need to have a call on zoom or how you want to take a look? |
@KumarUjjwal2022 if you can invite me to a GitHub repo with the failing code I can look |
@justinr1234 Actually due to rules and regulation we couldn't provide you code as it is confidential So it will be helpful for me if you can meet on zoom or any other means on call. |
@justinr1234 how can we resolve it. Now i'm getting this issue frequently. The exact error is :- XrplError: Websocket connection never cleaned up. |
@KumarUjjwal2022 please provide a minimal code example that we can run to reproduce the issue. |
@KumarUjjwal2022 Here are some instructions on producing a minimal code example: https://stackoverflow.com/help/minimal-reproducible-example |
@justinr1234 @intelliot Actually at first their is sign in process and then i use to connect with ledger and fetch balance , while fetching balance i.e. getting account_info and account_lines . At that time it gives Websocket connection never cleaned. sometimes this error comes frequently and sometimes it takes time. The code is below:- /* get accounts all currencies/token */ /* get accounts all balance */ and this method getAllCurrencies() is used on other js file i.e. Error comes in above catch block i.e. inside getBalance API. This is the whole process. |
@KumarUjjwal2022 please make a small public git repo that we can run and it shows the error reproducibly using only that small repo. Meaning, you should be able to make a small test app that shows the error. Then from there, I can take a look at it. |
What node are you connected to? s1/s2.ripple.com don't support |
@KumarUjjwal2022 please share which node you're using. Are you using a public server? If not, can you confirm that you're running your own rippled node? |
No @intelliot , I'm not running my own node. I'm using xrpl public server , the cluster one and another s2.ripple.com. I have tried switching between these two full history cluster. |
@intelliot I need help to setup admin connection with XRPL to perform different operation of NFTs. Could you explain process to make admin connection in Nodejs environment? I have gone through this link i.e. https://xrpl.org/connect.html but I'm confused at setting up connection with XRPL as right now I'm using xrpl npm to connect with XRPL server. for eg my code is this:- const xrpl = require("xrpl");
//CODE FOR DIFFERENT XRPL NFT OPERATION So what are the changes i need to do and how? |
You can’t make admin connections to the mainnet servers. What are you trying to accomplish? I can maybe help you figure it out. |
@intelliot As I get Websocket closed and related issues. So I want to make Admin connection. Mainly for which case we can have admin connection? As it is mentioned in XRPL docs. |
If you're being rate-limited, you'll need to run your own rippled node (instructions on how to do so are here). You can't get an admin connection for public nodes, like s1.ripple.com/s2.ripple.com/xrplcluster.com. |
Okay @intelliot . Thanks for the clarification. You means if i have to setup admin connection first we need to setup our our node and then setup admin connection? As I can observer that the NFT exchange on xrpl like Sologenic, Nftmaster, OnXRP etc doesn't have this connection issue. Does it means they have their on node setup? |
Yes, they do. |
Okay , so we need to setup our node or cluster @mvadari ?? |
Yes |
@justinr1234 Now I have ip for Node ,which can be used in below code :- { Now if I want to connect to ripple server how can i in nodejs as I have mentioned in above comment that I'm confused how to use CONNECT Method , weather i need to connect to xrpl first and then need to hit this CONNECT method or something different? |
What I mean is, what is the end goal you’re trying to accomplish? What are you building? What have you already built that is working? |
I'm working on XRPL NFT marketplace. Currently I connect with xrpl by xrpl NPM for any kind of Transaction Type/ operations like minting NFT , creating offers etc. For this I use to connect with XRPL in this way:- const xrpl = require("xrpl"); await client.connect(); but I think due to rate limit I need to have admin connection and own node setup. So I got ip from another team which is required for CONNECT method. So My query is how can i use this CONNECT method in nodejs environment as we have already one method to connect with xrpl server i.e. await client.connect(); . So what needs to be updated while making connection with xrpl server? |
@KumarUjjwal2022 In order to say the node you'd like to connect to, you have to use it in the spot where currently you have A So your above code would look like:
Make sure you include the port in the url - ex. |
Thanks @JST5000 one more help. Like I have to use only IP in project for making connection with xrpl and url including port should be configured/used on the other side from the party from whom I got IP address. Am I wright or wrong? Like for making connection with XRPL in my project the code should be like this:- await client.connect(); And the url with port configuration should be their at IP providers end, Am I correct? Also currenctly when I put IP on place of url I got this error:- |
Hey @KumarUjjwal2022, my understanding of your questions are:
|
Thanks @JST5000 . I used in same way also but get this error :- |
This is because the node you are hitting is using a self signed (aka snake oil) cert which is considered insecure. If you have any futher issues I recommend seeking help at xrpldevs.org |
Hi Team,
I am using xrpl package to connect and fetching account_lines as well as account_info. It worked for few weeks now it gives Websocket error mentioned above. My code is gives below:-
/* Get accounts all XRP */
async function getXrpBalance(ac) {
await client.connect();
let response = await client.request({
method: "account_info",
account: ac,
ledger_index: "validated",
});
await client.disconnect();
return {
currency: "XRP",
value: xrpl.dropsToXrp(response.result.account_data.Balance),
};
}
/* get accounts all currencies/token */
async function getIssuedCurrBalance(ac) {
await client.connect();
let response = await client.request({
method: "account_lines",
account: ac,
ledger_index: "validated",
});
await client.disconnect();
return response.result.lines.map((val) => ({ value: val.balance, currency: val.currency, issuer: val.account}));
}
/* get accounts all balance */
async function getAllCurrencies(ac) {
const xrpBalance = await getXrpBalance(ac);
const tokenBalance = await getIssuedCurrBalance(ac);
tokenBalance.unshift(xrpBalance)
return tokenBalance;
}
getAllCurrencies(ac);
I have seen one issue similar to it i.e. #1185 & #1186 but didn't get what to do with this. Someone please help.
The text was updated successfully, but these errors were encountered: