From d339643c0468befb972f68322d4ffd4f73a8e85d Mon Sep 17 00:00:00 2001 From: WofWca Date: Thu, 12 Dec 2024 14:16:42 +0400 Subject: [PATCH] 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 --- datachannel.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/datachannel.go b/datachannel.go index 218ebfbec08..63bad0a843e 100644 --- a/datachannel.go +++ b/datachannel.go @@ -438,8 +438,11 @@ func (d *DataChannel) ensureOpen() error { return nil } -// Detach allows you to detach the underlying datachannel. This provides -// an idiomatic API to work with, however it disables the OnMessage callback. +// Detach allows you to detach the underlying datachannel. +// This provides an idiomatic API to work with +// (`io.ReadWriteCloser` with its `.Read()` and `.Write()` methods, +// as opposed to `.Send()` and `.OnMessage`), +// however it disables the OnMessage callback. // Before calling Detach you have to enable this behavior by calling // webrtc.DetachDataChannels(). Combining detached and normal data channels // is not supported.