Skip to content

Commit

Permalink
Improve DataChannel.Detach() docstring
Browse files Browse the repository at this point in the history
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
  • Loading branch information
WofWca authored and Sean-Der committed Dec 13, 2024
1 parent 233526d commit 1c4bc79
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions datachannel.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 1c4bc79

Please sign in to comment.