
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
ipfs-pubsub-room
Advanced tools
Creates a room based on an IPFS pub-sub channel. Emits membership events, listens for messages, broadcast and direct messeges to peers.
This package has been tested with js-ipfs version 0.28.0.
$ npm install ipfs-pubsub-room
const Room = require('ipfs-pubsub-room')
const IPFS = require('ipfs')
const ipfs = new IPFS({
EXPERIMENTAL: {
pubsub: true
},
config: {
Addresses: {
Swarm: [
'/dns4/ws-star.discovery.libp2p.io/tcp/443/wss/p2p-websocket-star'
]
}
}
})
// IPFS node is ready, so we can start using ipfs-pubsub-room
ipfs.on('ready', () => {
const room = Room(ipfs, 'room-name')
room.on('peer joined', (peer) => {
console.log('Peer joined the room', peer)
})
room.on('peer left', (peer) => {
console.log('Peer left...', peer)
})
// now started to listen to room
room.on('subscribed', () => {
console.log('Now connected!')
})
})
ipfs
: IPFS object. Must have pubsub activatedroomName
: string, global identifier for the roomoptions
: object:
pollInterval
: interval for polling the pubsub peers, in ms. Defaults to 1000.const room = Room(ipfs, 'some-room-name')
Broacasts message (string or buffer).
Sends message (string or buffer) to peer.
Leaves room, stopping everything.
Returns an array of peer identifiers (strings).
Returns a boolean indicating if the given peer is present in the room.
Listens for messages. A message
is an object containing the following properties:
from
(string): peer iddata
(Buffer): message contentOnce a peer has joined the room.
Once a peer has left the room.
Once your program has subscribed the topic and announced through IPFS pubsub.
ISC
1.2.1 (2018-05-03)
<a name="1.2.0"></a>
FAQs
IPFS pub-sub room
The npm package ipfs-pubsub-room receives a total of 186 weekly downloads. As such, ipfs-pubsub-room popularity was classified as not popular.
We found that ipfs-pubsub-room demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.