Running geth with websocket:
geth --fast --cache=512 --ws --wsorigins="*" --wsapi "db,eth,net,ssh,miner,web3,personal,admin"
Then connecting with web3 in a Node.js app:
const Web3 = require('web3');
var web3 = new Web3(new Web3.providers.WebsocketProvider("ws://localhost:8546"));
console.log(web3.version);
web3.eth.subscribe('pendingTransactions', function(err, res) {
console.log('Here')
console.log(err)
console.log(res)
}).on('data', function(transaction) {
console.log('Here 2')
console.log(transaction)
});
"Here", "Here 2" do not print to the console. The subscription does not seem to activate. web3.version
and other web3 commands work fine.
Geth version: 1.7.1-stable
Web3 version: 1.0.0-beta.22
1.8.8-stable-2688dab4
and it seems to work again – oktapodia May 16 '18 at 12:21