package datachannel
Import Path
github.com/pion/datachannel (on go.dev)
Dependency Relation
imports 9 packages, and imported by 2 packages
Involved Source Files
Package datachannel implements WebRTC Data Channels
errors.go
message.go
message_channel_ack.go
message_channel_open.go
Package-Level Type Names (total 9)
ChannelType determines the reliability of the WebRTC DataChannel
( ChannelType) String() string
ChannelType : expvar.Var
ChannelType : fmt.Stringer
const ChannelTypePartialReliableRexmit
const ChannelTypePartialReliableRexmitUnordered
const ChannelTypePartialReliableTimed
const ChannelTypePartialReliableTimedUnordered
const ChannelTypeReliable
const ChannelTypeReliableUnordered
Config is used to configure the data channel.
ChannelType ChannelType
Label string
LoggerFactory logging.LoggerFactory
Negotiated bool
Priority uint16
Protocol string
ReliabilityParameter uint32
func Accept(a *sctp.Association, config *Config, existingChannels ...*DataChannel) (*DataChannel, error)
func Client(stream *sctp.Stream, config *Config) (*DataChannel, error)
func Dial(a *sctp.Association, id uint16, config *Config) (*DataChannel, error)
func Server(stream *sctp.Stream, config *Config) (*DataChannel, error)
DataChannel represents a data channel
Config Config
Config.ChannelType ChannelType
Config.Label string
Config.LoggerFactory logging.LoggerFactory
Config.Negotiated bool
Config.Priority uint16
Config.Protocol string
Config.ReliabilityParameter uint32
BufferedAmount returns the number of bytes of data currently queued to be
sent over this stream.
BufferedAmountLowThreshold returns the number of bytes of buffered outgoing
data that is considered "low." Defaults to 0.
BytesReceived returns the number of bytes received
BytesSent returns the number of bytes sent
Close closes the DataChannel and the underlying SCTP stream.
MessagesReceived returns the number of messages received
MessagesSent returns the number of messages sent
OnBufferedAmountLow sets the callback handler which would be called when the
number of bytes of outgoing data buffered is lower than the threshold.
OnOpen sets an event handler which is invoked when
a DATA_CHANNEL_ACK message is received.
The handler is called only on thefor the channel opened
https://datatracker.ietf.org/doc/html/draft-ietf-rtcweb-data-protocol-09#section-5.2
Read reads a packet of len(p) bytes as binary data
ReadDataChannel reads a packet of len(p) bytes
SetBufferedAmountLowThreshold is used to update the threshold.
See BufferedAmountLowThreshold().
SetReadDeadline sets a deadline for reads to return
SetWriteDeadline sets a deadline for writes to return,
only available if the BlockWrite is enabled for sctp
StreamIdentifier returns the Stream identifier associated to the stream.
Write writes len(p) bytes from p as binary data
WriteDataChannel writes len(p) bytes from p
*DataChannel : ReadDeadliner
*DataChannel : Reader
*DataChannel : ReadWriteCloser
*DataChannel : ReadWriteCloserDeadliner
*DataChannel : WriteDeadliner
*DataChannel : Writer
*DataChannel : github.com/pion/stun.Connection
*DataChannel : github.com/pion/stun/v3.Connection
*DataChannel : github.com/miekg/dns.Writer
*DataChannel : github.com/prometheus/common/expfmt.Closer
*DataChannel : internal/bisect.Writer
*DataChannel : io.Closer
*DataChannel : io.ReadCloser
*DataChannel : io.Reader
*DataChannel : io.ReadWriteCloser
*DataChannel : io.ReadWriter
*DataChannel : io.WriteCloser
*DataChannel : io.Writer
func Accept(a *sctp.Association, config *Config, existingChannels ...*DataChannel) (*DataChannel, error)
func Client(stream *sctp.Stream, config *Config) (*DataChannel, error)
func Dial(a *sctp.Association, id uint16, config *Config) (*DataChannel, error)
func Server(stream *sctp.Stream, config *Config) (*DataChannel, error)
func Accept(a *sctp.Association, config *Config, existingChannels ...*DataChannel) (*DataChannel, error)
ReadDeadliner extends an io.Reader to expose setting a read deadline.
( ReadDeadliner) SetReadDeadline(time.Time) error
*DataChannel
ReadWriteCloserDeadliner (interface)
*github.com/pion/dtls/v2.Conn
*github.com/pion/dtls/v3.Conn
*github.com/pion/dtls/v3/internal/net.PacketBuffer
*github.com/pion/dtls/v3/internal/net/udp.PacketConn
*github.com/pion/ice/v4.Conn
*github.com/pion/ice/v4/internal/fakenet.MockPacketConn
github.com/pion/ice/v4/internal/fakenet.PacketConn
*github.com/pion/sctp.Stream
*github.com/pion/srtp/v3.ReadStreamSRTCP
*github.com/pion/srtp/v3.ReadStreamSRTP
github.com/pion/transport/v2.TCPConn (interface)
github.com/pion/transport/v2.UDPConn (interface)
*github.com/pion/transport/v2/packetio.Buffer
github.com/pion/transport/v2/udp.BatchConn
*github.com/pion/transport/v2/udp.Conn
github.com/pion/transport/v3.TCPConn (interface)
github.com/pion/transport/v3.UDPConn (interface)
*github.com/pion/transport/v3/packetio.Buffer
*github.com/pion/transport/v3/vnet.UDPConn
*github.com/pion/turn/v4.STUNConn
github.com/pion/turn/v4/internal/client.TCPConn
*github.com/pion/turn/v4/internal/client.UDPConn
*github.com/pion/webrtc/v4.RTPReceiver
*github.com/pion/webrtc/v4.RTPSender
*github.com/pion/webrtc/v4.TrackRemote
*github.com/pion/webrtc/v4/internal/mux.Endpoint
github.com/coreos/etcd/pkg/fileutil.LockedFile
*github.com/gorilla/websocket.Conn
github.com/libp2p/go-libp2p/core/network.MuxedStream (interface)
github.com/libp2p/go-libp2p/core/network.Stream (interface)
github.com/libp2p/go-libp2p/core/sec.SecureConn (interface)
github.com/libp2p/go-libp2p/core/sec/insecure.Conn
*github.com/libp2p/go-libp2p/p2p/net/swarm.Stream
*github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/client.Conn
github.com/libp2p/go-libp2p/p2p/transport/tcpreuse/internal/sampledconn.ManetTCPConnInterface (interface)
*github.com/libp2p/go-libp2p/p2p/transport/websocket.Conn
*github.com/libp2p/go-yamux/v5.Stream
github.com/marten-seemann/tcp.Conn
github.com/miekg/dns.Conn
github.com/miekg/dns.Transfer
github.com/multiformats/go-multiaddr/net.Conn (interface)
github.com/multiformats/go-multiaddr/net.PacketConn (interface)
*github.com/polarsignals/wal/fs.File
github.com/quic-go/quic-go.OOBCapablePacketConn (interface)
github.com/quic-go/quic-go.ReceiveStream (interface)
github.com/quic-go/quic-go.Stream (interface)
github.com/quic-go/quic-go/http3.RequestStream (interface)
github.com/quic-go/quic-go/http3.Stream (interface)
github.com/quic-go/webtransport-go.ReceiveStream (interface)
github.com/quic-go/webtransport-go.Stream (interface)
github.com/soheilhy/cmux.MuxConn
*crypto/tls.Conn
golang.org/x/net/internal/socks.Conn
*golang.org/x/net/ipv4.PacketConn
*golang.org/x/net/ipv4.RawConn
*golang.org/x/net/ipv6.PacketConn
*internal/poll.FD
net.Conn (interface)
*net.IPConn
net.PacketConn (interface)
*net.TCPConn
*net.UDPConn
*net.UnixConn
*net/http.ResponseController
*os.File
Reader is an extended io.Reader
that also returns if the message is text.
( Reader) ReadDataChannel([]byte) (int, bool, error)
*DataChannel
ReadWriteCloser (interface)
ReadWriteCloserDeadliner (interface)
ReadWriteCloser is an extended io.ReadWriteCloser
that also implements our Reader and Writer.
( ReadWriteCloser) Close() error
( ReadWriteCloser) Read(p []byte) (n int, err error)
( ReadWriteCloser) ReadDataChannel([]byte) (int, bool, error)
( ReadWriteCloser) Write([]byte) (int, error)
( ReadWriteCloser) WriteDataChannel([]byte, bool) (int, error)
*DataChannel
ReadWriteCloserDeadliner (interface)
ReadWriteCloser : Reader
ReadWriteCloser : Writer
ReadWriteCloser : github.com/pion/stun.Connection
ReadWriteCloser : github.com/pion/stun/v3.Connection
ReadWriteCloser : github.com/miekg/dns.Writer
ReadWriteCloser : github.com/prometheus/common/expfmt.Closer
ReadWriteCloser : internal/bisect.Writer
ReadWriteCloser : io.Closer
ReadWriteCloser : io.ReadCloser
ReadWriteCloser : io.Reader
ReadWriteCloser : io.ReadWriteCloser
ReadWriteCloser : io.ReadWriter
ReadWriteCloser : io.WriteCloser
ReadWriteCloser : io.Writer
func github.com/pion/webrtc/v4.(*DataChannel).Detach() (ReadWriteCloser, error)
ReadWriteCloserDeadliner is an extended ReadWriteCloser
that also implements r/w deadline.
( ReadWriteCloserDeadliner) Close() error
( ReadWriteCloserDeadliner) Read(p []byte) (n int, err error)
( ReadWriteCloserDeadliner) ReadDataChannel([]byte) (int, bool, error)
( ReadWriteCloserDeadliner) SetReadDeadline(time.Time) error
( ReadWriteCloserDeadliner) SetWriteDeadline(time.Time) error
( ReadWriteCloserDeadliner) Write([]byte) (int, error)
( ReadWriteCloserDeadliner) WriteDataChannel([]byte, bool) (int, error)
*DataChannel
ReadWriteCloserDeadliner : ReadDeadliner
ReadWriteCloserDeadliner : Reader
ReadWriteCloserDeadliner : ReadWriteCloser
ReadWriteCloserDeadliner : WriteDeadliner
ReadWriteCloserDeadliner : Writer
ReadWriteCloserDeadliner : github.com/pion/stun.Connection
ReadWriteCloserDeadliner : github.com/pion/stun/v3.Connection
ReadWriteCloserDeadliner : github.com/miekg/dns.Writer
ReadWriteCloserDeadliner : github.com/prometheus/common/expfmt.Closer
ReadWriteCloserDeadliner : internal/bisect.Writer
ReadWriteCloserDeadliner : io.Closer
ReadWriteCloserDeadliner : io.ReadCloser
ReadWriteCloserDeadliner : io.Reader
ReadWriteCloserDeadliner : io.ReadWriteCloser
ReadWriteCloserDeadliner : io.ReadWriter
ReadWriteCloserDeadliner : io.WriteCloser
ReadWriteCloserDeadliner : io.Writer
func github.com/pion/webrtc/v4.(*DataChannel).DetachWithDeadline() (ReadWriteCloserDeadliner, error)
WriteDeadliner extends an io.Writer to expose setting a write deadline.
( WriteDeadliner) SetWriteDeadline(time.Time) error
*DataChannel
ReadWriteCloserDeadliner (interface)
*github.com/pion/dtls/v2.Conn
*github.com/pion/dtls/v3.Conn
*github.com/pion/dtls/v3/internal/net/udp.PacketConn
*github.com/pion/ice/v4.Conn
*github.com/pion/ice/v4/internal/fakenet.MockPacketConn
github.com/pion/ice/v4/internal/fakenet.PacketConn
*github.com/pion/sctp.Stream
*github.com/pion/srtp/v3.WriteStreamSRTCP
*github.com/pion/srtp/v3.WriteStreamSRTP
github.com/pion/transport/v2.TCPConn (interface)
github.com/pion/transport/v2.UDPConn (interface)
github.com/pion/transport/v2/udp.BatchConn
*github.com/pion/transport/v2/udp.Conn
github.com/pion/transport/v3.TCPConn (interface)
github.com/pion/transport/v3.UDPConn (interface)
*github.com/pion/transport/v3/vnet.UDPConn
*github.com/pion/turn/v4.STUNConn
github.com/pion/turn/v4/internal/client.TCPConn
*github.com/pion/turn/v4/internal/client.UDPConn
*github.com/pion/webrtc/v4/internal/mux.Endpoint
github.com/coreos/etcd/pkg/fileutil.LockedFile
*github.com/gorilla/websocket.Conn
github.com/libp2p/go-libp2p/core/network.MuxedStream (interface)
github.com/libp2p/go-libp2p/core/network.Stream (interface)
github.com/libp2p/go-libp2p/core/sec.SecureConn (interface)
github.com/libp2p/go-libp2p/core/sec/insecure.Conn
*github.com/libp2p/go-libp2p/p2p/net/swarm.Stream
*github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/client.Conn
github.com/libp2p/go-libp2p/p2p/transport/tcpreuse/internal/sampledconn.ManetTCPConnInterface (interface)
*github.com/libp2p/go-libp2p/p2p/transport/websocket.Conn
*github.com/libp2p/go-yamux/v5.Stream
github.com/marten-seemann/tcp.Conn
github.com/miekg/dns.Conn
github.com/miekg/dns.Transfer
github.com/multiformats/go-multiaddr/net.Conn (interface)
github.com/multiformats/go-multiaddr/net.PacketConn (interface)
*github.com/polarsignals/wal/fs.File
github.com/quic-go/quic-go.OOBCapablePacketConn (interface)
github.com/quic-go/quic-go.SendStream (interface)
github.com/quic-go/quic-go.Stream (interface)
github.com/quic-go/quic-go/http3.RequestStream (interface)
github.com/quic-go/quic-go/http3.Stream (interface)
github.com/quic-go/webtransport-go.SendStream (interface)
github.com/quic-go/webtransport-go.Stream (interface)
github.com/soheilhy/cmux.MuxConn
*crypto/tls.Conn
golang.org/x/net/internal/socks.Conn
*golang.org/x/net/ipv4.PacketConn
*golang.org/x/net/ipv4.RawConn
*golang.org/x/net/ipv6.PacketConn
*internal/poll.FD
net.Conn (interface)
*net.IPConn
net.PacketConn (interface)
*net.TCPConn
*net.UDPConn
*net.UnixConn
*net/http.ResponseController
*os.File
Writer is an extended io.Writer
that also allows indicating if a message is text.
( Writer) WriteDataChannel([]byte, bool) (int, error)
*DataChannel
ReadWriteCloser (interface)
ReadWriteCloserDeadliner (interface)
Package-Level Functions (total 5)
Accept is used to accept incoming data channels over SCTP
Client opens a data channel over an SCTP stream
Dial opens a data channels over SCTP
Server accepts a data channel over an SCTP stream
TryMarshalUnmarshal attempts to marshal and unmarshal a message. Added for fuzzing.
Package-Level Variables (total 6)
ErrDataChannelMessageTooShort means that the data isn't long enough to be a valid DataChannel message
ErrExpectedAndActualLengthMismatch is when the declared length and actual length don't match
ErrInvalidChannelType means that the remote requested a channel type that we don't support
ErrInvalidMessageType is returned when a DataChannel Message has a type we don't support
ErrInvalidPayloadProtocolIdentifier means that we got a DataChannel messages with a Payload Protocol Identifier
we don't know how to handle
ErrUnexpectedDataChannelType is when a message type does not match the expected type
Package-Level Constants (total 10)
ChannelPriority enums
ChannelPriority enums
ChannelPriority enums
ChannelPriority enums
ChannelTypePartialReliableRexmit determines the Data Channel
provides a partially-reliable in-order bi-directional communication.
User messages will not be retransmitted more times than specified in the Reliability Parameter.
ChannelTypePartialReliableRexmitUnordered determines
the Data Channel provides a partial reliable unordered bi-directional communication.
User messages will not be retransmitted more times than specified in the Reliability Parameter.
ChannelTypePartialReliableTimed determines the Data Channel
provides a partial reliable in-order bi-directional communication.
User messages might not be transmitted or retransmitted after
a specified life-time given in milli- seconds in the Reliability Parameter.
This life-time starts when providing the user message to the protocol stack.
The Data Channel provides a partial reliable unordered bi-directional
communication. User messages might not be transmitted or retransmitted
after a specified life-time given in milli- seconds in the Reliability Parameter.
This life-time starts when providing the user message to the protocol stack.
ChannelTypeReliable determines the Data Channel provides a
reliable in-order bi-directional communication.
ChannelTypeReliableUnordered determines the Data Channel
provides a reliable unordered bi-directional communication.
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |