Trying to connect to a geth machine over websocket? JS code.

var Web3=require('web3');
var web3 = new Web3(new 

Not sure how to connect using WebSocket?


I had the same issue with web3 v1.0.0 beta 30. Never got to the bottom of it but skipping the provider construction appeared to fix it:

var Web3=require('web3');
var web3 = new Web3('ws://');

I assume that you're using a version of Web3.js older than 1.0. I believe that the WebsocketProvider was added in 1.0.

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.