mirror of
https://github.com/pion/webrtc.git
synced 2025-11-02 23:34:17 +08:00
DataChannel messages are now printed to stdout. This also adds a new datachannel package that parses ChannelOpen, and starts the skeleton of getting the data to the public API
41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
package network
|
|
|
|
import (
|
|
"github.com/pions/webrtc/pkg/rtp"
|
|
)
|
|
|
|
// BufferTransportGenerator generates a new channel for the associated SSRC
|
|
// This channel is used to send RTP packets to users of pion-WebRTC
|
|
type BufferTransportGenerator func(uint32, uint8) chan<- *rtp.Packet
|
|
|
|
// ICENotifier notifies the RTCPeerConnection if ICE state has changed for this port
|
|
type ICENotifier func(*Port)
|
|
|
|
// DataChannelEventHandler notifies the RTCPeerConnection of events relating to DataChannels
|
|
type DataChannelEventHandler func(*DataChannelEvent)
|
|
|
|
// DataChannelEventType is the enum used to represent different types of DataChannelEvent
|
|
type DataChannelEventType int
|
|
|
|
// Enums for DataChannelEventType
|
|
const (
|
|
NewDataChannel int = iota + 1
|
|
NewMessage
|
|
)
|
|
|
|
// DataChannelEvent is the interface for all events that flow across the DataChannelEventHandler
|
|
type DataChannelEvent interface {
|
|
Type() DataChannelEventType
|
|
}
|
|
|
|
// DataChannelCreated is emitted when a new DataChannel is created
|
|
type DataChannelCreated struct {
|
|
Label string
|
|
}
|
|
|
|
// DataChannelMessage is emitted when a DataChannel recieves a message
|
|
type DataChannelMessage struct {
|
|
Label string
|
|
Message []byte
|
|
}
|