
Product
Introducing GitHub Actions Scanning Support
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.
p2p-broadcast
Advanced tools
Simple P2P message broadcasting
npm install p2p-broadcast
const node = new Node({
port: 6000,
seedHosts: ['example.com:1234'],
minPeers: 3,
maxPeers: 10,
debug: console.log,
validate: message => {} // will ignore message if error is thrown
})
All options are optional.
import { Node } from 'p2p-broadcast'
const seedHosts = ['localhost:6000']
const a = new Node({ port: 6000 })
const b = new Node({ seedHosts })
const c = new Node({ port: 6001, seedHosts, onConnect })
const onBeep = n => ({ id, name, data, peer, hops }) => {
console.log(n, name, data)
}
a.on('beep', onBeep('a'))
b.on('beep', onBeep('b'))
c.on('beep', onBeep('c'))
c.broadcast('beep', { hello: 'world' })
// --- output ---
// a beep { hello: 'world' }
// b beep { hello: 'world' }
const onConnect = ({ peer }) => console.log(Connected to ${peer.node.host}
)
New nodes join the network to form a partial mesh network topology.
FAQs
Simple P2P message broadcasting
We found that p2p-broadcast demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.
Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.