1

I want to connect to rinkeby.infura testnet by using WebsocketProvider but the page remains blocked to load.

const Web3 = require('web3');

console.log(Web3.givenProvider);

var web3 = new Web3( new Web3.providers.WebsocketProvider('wss://rinkeby.infura.io/ws'));

var subscription = web3.eth.subscribe('logs', {
    address: '0x8789497B837437632143efFb87d74F40D4EDDcFe'
}, function(error, result){
    if (!error)
        console.log(log);
});


// unsubscribes the subscription
subscription.unsubscribe((error, success) => {
  if (error) return console.error(error);

  console.log('Successfully unsubscribed!');
});

The current version of web3 is: 1.0.0-beta.34

1

Check if the page is accessible first. Sometimes the page itself may be down, happened for me with Ropsten

  • Comments are not for extended discussion; this conversation has been moved to chat. – eth Apr 20 '18 at 8:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.