Skip to content

Commit d258b09

Browse files
committed
fix: close datachannel on stream finish
1 parent d994859 commit d258b09

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/transport-webrtc/src/muxer.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ export class DataChannelMuxer implements StreamMuxer {
131131
direction: 'inbound',
132132
dataChannelOptions: this.dataChannelOptions,
133133
onEnd: () => {
134+
channel.close()
134135
this.streams = this.streams.filter(s => s.id !== stream.id)
135136
this.metrics?.increment({ stream_end: true })
136137
init?.onStreamEnd?.(stream)
@@ -158,6 +159,7 @@ export class DataChannelMuxer implements StreamMuxer {
158159
direction: 'outbound',
159160
dataChannelOptions: this.dataChannelOptions,
160161
onEnd: () => {
162+
channel.close()
161163
this.streams = this.streams.filter(s => s.id !== stream.id)
162164
this.metrics?.increment({ stream_end: true })
163165
this.init?.onStreamEnd?.(stream)

0 commit comments

Comments
 (0)