Skip to content

Commit dfbe0cc

Browse files
authored
fix: datachannel label should be an empty string (#2204)
Fixes regession introduced by #2200
1 parent cff86df commit dfbe0cc

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

packages/transport-webrtc/src/muxer.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ interface BufferedStream {
3838
onEnd(err?: Error): void
3939
}
4040

41-
let streamIndex = 0
42-
4341
export class DataChannelMuxerFactory implements StreamMuxerFactory {
4442
public readonly protocol: string
4543

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

192190
newStream (): Stream {
193-
streamIndex++
194-
195191
// The spec says the label SHOULD be an empty string: https://github.com/libp2p/specs/blob/master/webrtc/README.md#rtcdatachannel-label
196-
const channel = this.peerConnection.createDataChannel(`stream-${streamIndex}`)
192+
const channel = this.peerConnection.createDataChannel('')
197193
const stream = createStream({
198194
channel,
199195
direction: 'outbound',

0 commit comments

Comments
 (0)