message bus for bitcoin
bitsocketd has a dependency on bitdb.
npm install --save bitsocketd
If you already have BitDB running on port 28339, you can simply do this:
const bitsocketd = require('bitsocketd')
bitsocketd.init()
You will see a screen like this:
Now open your browser to the socket URL and you'll see SSE pouring in.
That's the raw firehose. You probably don't want to consume the whole thing, so make sure to add a bitquery filter. Learn more at https://bitsocket.org/docs
You can specify the Zeromq subscriber from a bitdb node, like this:
const bitsocketd = require('bitsocketd')
bitsocketd.init({
bit: { host: "127.0.0.1", port: 28339 },
})
By default Bitdb's zeromq publisher broadcasts to port 28339, but you can customize if you want.
By default, the SSE port is automatically 3001. You can customize this:
const bitsocketd = require('bitsocketd')
bitsocketd.init({
socket: { port: 3001 }
})
// Step 1. express.js web server init
const express = require("express")
const app = express()
app.listen(3000 , function () {
console.log("web server listening at " + port)
})
// Step 2. pass the express server to bitsocketd
const bitsocketd = require('bitsocketd')
bitsocketd.init({
socket: { app: app }
})
IFWallet