Skip to content

Instantly share code, notes, and snippets.

@cloudonshore
Last active November 5, 2019 00:16
Show Gist options
  • Save cloudonshore/1e77fb2e748c51fbd2c66f9eea4a5b2c to your computer and use it in GitHub Desktop.
Save cloudonshore/1e77fb2e748c51fbd2c66f9eea4a5b2c to your computer and use it in GitHub Desktop.
const ws = require("nodejs-websocket")
const options = { extraHeaders: { Authorization: 'Basic ' + Buffer.from('892bf962872d4f84b779fa893e138f7b').toString('base64') } }
const conn = ws.connect('wss://mainnet.infura.io/ws/v3/1fa032434d904e018fbbc138d3f6cb3c', options, () => {
console.log( 'we are connected now')
conn.on("text", function (str) {
console.log("Received "+str)
})
conn.sendText('{"jsonrpc":"2.0","method":"eth_newBlockFilter","params":[],"id":1}')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment