Skip to content
This repository has been archived by the owner on Apr 24, 2023. It is now read-only.

Commit

Permalink
feat: webrtc in browser and nodejs complete
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Nov 17, 2016
1 parent 3097589 commit 942d501
Showing 1 changed file with 11 additions and 20 deletions.
31 changes: 11 additions & 20 deletions src/webrtc-star/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,14 @@ function WebRTCStar () {
const intentId = (~~(Math.random() * 1e9)).toString(36) + Date.now()
const sioClient = listeners[Object.keys(listeners)[0]].io

let channel
const spOptions = {
initiator: true,
trickle: false
}
if (isNode) {
channel = new SimplePeer({
initiator: true,
trickle: false,
wrtc: wrtc
})
} else {
channel = new SimplePeer({
initiator: true,
trickle: false
})
spOptions.wrtc = wrtc
}
const channel = new SimplePeer(spOptions)

const conn = new Connection(toPull.duplex(channel))
let connected = false
Expand Down Expand Up @@ -144,17 +139,13 @@ function WebRTCStar () {
return
}

let channel
const spOptions = {
trickle: false
}
if (isNode) {
channel = new SimplePeer({
trickle: false,
wrtc: wrtc
})
} else {
channel = new SimplePeer({
trickle: false
})
spOptions.wrtc = wrtc
}
const channel = new SimplePeer(spOptions)

const conn = new Connection(toPull.duplex(channel))

Expand Down

0 comments on commit 942d501

Please sign in to comment.