Skip to content

Commit 1c4bc79

Browse files
WofWcaSean-Der
authored andcommitted
Improve DataChannel.Detach() docstring
It wasn't clear (at least to me) what "idiomatic API" it's referring to. But, judging from the `data-channels-detach` example comments, this is what it's made for. https://github.com/pion/webrtc/blob/f29ef99b220beb906c60e7f1aebac6c02498daf9/examples/data-channels-detach/main.go#L4
1 parent 233526d commit 1c4bc79

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

datachannel.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,11 @@ func (d *DataChannel) ensureOpen() error {
438438
return nil
439439
}
440440

441-
// Detach allows you to detach the underlying datachannel. This provides
442-
// an idiomatic API to work with, however it disables the OnMessage callback.
441+
// Detach allows you to detach the underlying datachannel.
442+
// This provides an idiomatic API to work with
443+
// (`io.ReadWriteCloser` with its `.Read()` and `.Write()` methods,
444+
// as opposed to `.Send()` and `.OnMessage`),
445+
// however it disables the OnMessage callback.
443446
// Before calling Detach you have to enable this behavior by calling
444447
// webrtc.DetachDataChannels(). Combining detached and normal data channels
445448
// is not supported.

0 commit comments

Comments
 (0)