Skip to content

My room did nothing when a peer has joined? #69

@fCorleone

Description

@fCorleone

I was following the demo video on youtube: https://www.youtube.com/watch?v=Nv_Teb--1zg
But when I add a room in my code and test it. The console gives no reactions when another peer joined the room.
Here's my code:

const IPFS = require('ipfs')
const Room = require('ipfs-pubsub-room')

const ipfs = new IPFS({
	repo: repo(),
	EXPERIMENTAL: {
		pubsub : true
	}
})

ipfs.once('ready', () => ipfs.id((err,info) => {
	if (err) {throw err}
	console.log('IPFS is ready with the address ' + info.id)
}))

const room = Room(ipfs, 'ipfs-pubsub-room-demo')
console.log(room.id)
room.on('peer joined', (peer) => console.log('some peer '+ peer +' has joined'))
room.on('peer left', (peer) => console.log('some peer '+ peer +' has left'))

function repo () {
	return 'ipfs/pubsub-demo/' + Math.random()
}

And when I test the code on Chrome, the console only gives the ID of the node, but no messages like 'some peer XXXX has joined.'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions