mafintosh / webrtc-swarm

Create a swarm of p2p connections using webrtc and a signalhub
MIT License
380 stars 60 forks source link

Initial broadcast doesn't fire in browser #2

Closed uiur closed 8 years ago

uiur commented 9 years ago

I'm using this module with browserify in Chrome latest. I tried the example, but it didn't work.

I've found 'open' event doesn't fire from hub.subscribe(me), so connect() doesn't trigger.

hub.subscribe(me).once('open', connect).pipe(through.obj(function (data, enc, cb) {

https://github.com/mafintosh/webrtc-swarm/blob/master/index.js#L77

My current workaround is just use setTimeout.

setTimeout(connect, 0)

hub.subscribe(me).pipe(through.obj(function (data, enc, cb) {

Do you have any idea about this issue?

mafintosh commented 8 years ago

Try trying again with the latest version of signalhub (4.1.1) which fixes some bugs that might be related to this.

uiur commented 8 years ago

It works! Thanks :)

mafintosh commented 8 years ago

\o/