Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fCorleone opened this issue Jul 5, 2019 · 0 comments
Open

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

fCorleone opened this issue Jul 5, 2019 · 0 comments

Comments

@fCorleone
Copy link

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.'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant