Files
webrtc/rtcdatachannel.go
Sean DuBois cd2f9df294 Update DataChannel APIs for payload types
Users can now get/set what payload types they are sending and receiving
2018-07-26 00:46:45 -07:00

23 lines
661 B
Go

package webrtc
import "github.com/pions/webrtc/pkg/datachannel"
// RTCDataChannel represents a WebRTC DataChannel
// The RTCDataChannel interface represents a network channel
// which can be used for bidirectional peer-to-peer transfers of arbitrary data
type RTCDataChannel struct {
Onmessage func(datachannel.Payload)
ID uint16
Label string
rtcPeerConnection *RTCPeerConnection
}
// Send sends the passed message to the DataChannel peer
func (r *RTCDataChannel) Send(p datachannel.Payload) error {
if err := r.rtcPeerConnection.networkManager.SendDataChannelMessage(p, r.ID); err != nil {
return &UnknownError{Err: err}
}
return nil
}