WebSocket connection to 'wss://wallet-connect.crypto.com' failed

Dung Do Tien Aug 28 2022 37

Hello guys,  I have created an application that helps connect to DeFi wallet of Cronos.  I follow the setup Defi wallet by this link:

 https://cronos.org/docs/resources/web-extension-integration.html#introduction

And here is my Javascript code:

 try {
    walletConnect = null;
    walletConnect = new window.DeFiConnect.DeFiWeb3Connector({
        supportedChainIds: [25],
        rpc: {
            25: "https://evm.cronos.org/"
        },
        pollingInterval: 15000
    });

    await walletConnect.activate();
    const provider = await walletConnect.getProvider();
    web3ojb = new Web3(provider);
    typeOfLogin = type;
} catch (err) {
    console.log('Error from Defi wallet: ' + err);
    alert('Failed to establish a connection to DeFi Wallet.');
    window.location.reload();
    await walletConnect.deactivate()
    return;
}

And when I run this code, it shows a QR code for me

WebSocket connection to 'wss://wallet-connect.crypto.com' failed

But check in the Console tab of the browser I see this exception WebSocket connection to 'wss://wallet-connect.crypto.com' failed

 VM815 index.umd.js:26 WebSocket connection to 'wss://wallet-connect.crypto.com/api/v1/ncwconnect/relay/ws?dapp_name=&env=browser&host=example.com&protocol=wc&role=dapp&version=3' failed: 
_socketCreate    @    VM815 index.umd.js:26
(anonymous)    @    VM815 index.umd.js:26 

WebSocket connection to 'wss://wallet-connect.crypto.com' failed

I used a smartphone to scan QR codes but always threw the wrong setup.

What is wrong with my code? I really added web3.js and Defi libs to the HTML page.

Can anyone help me?

Have 1 answer(s) found.
  • A

    Anuja Abhang Aug 28 2022

    I really got this issue when adding Defi wallet to my project. 

    Solution: add <title> tag to your HTML page.

    Explain: Defi uses value inside <title> tag for the app name.

    I hope this answer useful for you.

Leave An Answer
* NOTE: You need Login before leave an answer

* Type maximum 2000 characters.

* All comments have to wait approved before display.

* Please polite comment and respect questions and answers of others.

Popular Tips

X Close