Skip to content

Commit

Permalink
Add 'type' property to all 'signal' messages
Browse files Browse the repository at this point in the history
Only some signaling message have 'type' properties. The others rely on the key name that is in use.

Having a 'type' in all messages improves console debug logs (since I can include the type in the output).
  • Loading branch information
feross committed Oct 28, 2020
1 parent cf01adf commit e1d4660
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ class Peer extends stream.Duplex {
}
} else {
this.emit('signal', { // request initiator to renegotiate
type: 'transceiverRequest',
transceiverRequest: { kind, init }
})
}
Expand Down Expand Up @@ -388,6 +389,7 @@ class Peer extends stream.Duplex {
} else {
this._debug('requesting negotiation from initiator')
this.emit('signal', { // request initiator to renegotiate
type: 'renegotiate',
renegotiate: true
})
}
Expand Down Expand Up @@ -908,6 +910,7 @@ class Peer extends stream.Duplex {
if (this.destroyed) return
if (event.candidate && this.trickle) {
this.emit('signal', {
type: 'candidate',
candidate: {
candidate: event.candidate.candidate,
sdpMLineIndex: event.candidate.sdpMLineIndex,
Expand Down

0 comments on commit e1d4660

Please sign in to comment.