
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
@rsksmart/rif-communications-pubsub
Advanced tools
Library for creating a PubSub room with libp2p
This project extends the ipfs-pubsub-room, rewriting it in typescript and adding libp2p node.
> npm install @rsksmart/rif-communications-pubsub
WARNING: This package still have not been released!
Example of usage:
import { Room, DirectChat, createLibP2P, Message, MessageDirect } from '@rsksmart/rif-communications-pubsub'
const libp2p = await createLibP2P()
const room = createRoom(libp2p, 'my_topic')
room.on('peer:joined', (peer: string) => {
console.log('Peer joined the room ', peer)
})
room.on('peer:left', (peer: string) => {
console.log('Peer left the room', peer)
})
room.on('message', ({from, data}: Message) => {
console.log('New message from ', peer, ' content ', data)
})
room.on('unsubscribed', () => {
console.log('Unsubscribed from the room room')
})
const directChat = DirectChat.getDirectChat(libp2p)
directChat.on('message', ({from, to, data}: MessageDirect) => {
console.log('New direct message from ', peer, ' to ', to, ' content ', data)
})
const libp2p = await createLibP2P()
const room = createRoom(libp2p, topic) // Creates room with specific topic
// Methods
room.leave() // Leave the room
async room.broadcast(message: string | buffer) // Send message to the room
// Getters
room.peerId
room.peers
room.hasPeer(peerId: string)
room.libp2p
// Listeners
room.on('peer:joined', (peerId: string) => {})
room.on('peer:left', (peerId: string) => {})
room.on('message', (message: Message) => {})
room.on('unsubscribed', () => {})
room.on('error', (error: Error) => {})
const directChat = DirectChat.getDirectChat(libp2p)
// Methods
directChat.sendTo('somePeerId', {level: 'info', msg: 'hello world with custom object'})
// Listeners
directChat.on('message', (message: MessageDirect) => {})
directChat.on('error', (error: Error) => {})
FAQs
PubSub module
We found that @rsksmart/rif-communications-pubsub 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
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.