Skip to content

Commit

Permalink
fix: datachannel label should be an empty string (#2204)
Browse files Browse the repository at this point in the history
Fixes regession introduced by #2200
  • Loading branch information
achingbrain authored Nov 6, 2023
1 parent cff86df commit dfbe0cc
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions packages/transport-webrtc/src/muxer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ interface BufferedStream {
onEnd(err?: Error): void
}

let streamIndex = 0

export class DataChannelMuxerFactory implements StreamMuxerFactory {
public readonly protocol: string

Expand Down Expand Up @@ -190,10 +188,8 @@ export class DataChannelMuxer implements StreamMuxer {
sink: Sink<Source<Uint8Array | Uint8ArrayList>, Promise<void>> = nopSink

newStream (): Stream {
streamIndex++

// The spec says the label SHOULD be an empty string: https://github.com/libp2p/specs/blob/master/webrtc/README.md#rtcdatachannel-label
const channel = this.peerConnection.createDataChannel(`stream-${streamIndex}`)
const channel = this.peerConnection.createDataChannel('')
const stream = createStream({
channel,
direction: 'outbound',
Expand Down

0 comments on commit dfbe0cc

Please sign in to comment.