datachannel

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChannelPriorityBelowNormal uint16 = 128
	ChannelPriorityNormal      uint16 = 256
	ChannelPriorityHigh        uint16 = 512
	ChannelPriorityExtraHigh   uint16 = 1024
)

ChannelPriority enums

View Source
const (
	PayloadTypeString = iota + 1
	PayloadTypeBinary
)

PayloadType enums

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelAck

type ChannelAck struct{}

ChannelAck is used to ACK a DataChannel open

func (*ChannelAck) Marshal

func (c *ChannelAck) Marshal() ([]byte, error)

Marshal returns raw bytes for the given message

func (*ChannelAck) Unmarshal

func (c *ChannelAck) Unmarshal(raw []byte) error

Unmarshal populates the struct with the given raw data

type ChannelOpen

type ChannelOpen struct {
	ChannelType          ChannelType
	Priority             uint16
	ReliabilityParameter uint32

	Label    []byte
	Protocol []byte
}

ChannelOpen represents a DATA_CHANNEL_OPEN Message

0                   1                   2                   3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Message Type | Channel Type | Priority | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Reliability Parameter | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Label Length | Protocol Length | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | Label | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | | Protocol | | | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

func (*ChannelOpen) Marshal

func (c *ChannelOpen) Marshal() ([]byte, error)

Marshal returns raw bytes for the given message

func (*ChannelOpen) Unmarshal

func (c *ChannelOpen) Unmarshal(raw []byte) error

Unmarshal populates the struct with the given raw data

type ChannelType

type ChannelType byte

ChannelType determines the reliability of the WebRTC DataChannel

const (
	// ChannelTypeReliable determines the Data Channel provides a
	// reliable in-order bi-directional communication.
	ChannelTypeReliable ChannelType = 0x00
	// ChannelTypeReliableUnordered determines the Data Channel
	// provides a reliable unordered bi-directional communication.
	ChannelTypeReliableUnordered ChannelType = 0x80
	// 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.
	ChannelTypePartialReliableRexmit ChannelType = 0x01
	// 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.
	ChannelTypePartialReliableRexmitUnordered ChannelType = 0x81
	// 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.
	ChannelTypePartialReliableTimed ChannelType = 0x02
	// 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.
	ChannelTypePartialReliableTimedUnordered ChannelType = 0x82
)

ChannelType enums

type Message

type Message interface {
	Marshal() ([]byte, error)
	Unmarshal([]byte) error
}

Message is a parsed DataChannel message

func Parse

func Parse(raw []byte) (Message, error)

Parse accepts raw input and returns a DataChannel message

type MessageType

type MessageType byte

MessageType is the first byte in a DataChannel message that specifies type

const (
	DataChannelAck  MessageType = 0x02
	DataChannelOpen MessageType = 0x03
)

DataChannel Message Types

type Payload

type Payload interface {
	PayloadType() PayloadType
}

Payload is the body of a DataChannel message

type PayloadBinary

type PayloadBinary struct {
	Data []byte
}

PayloadBinary is a binary DataChannel message

func (PayloadBinary) PayloadType

func (p PayloadBinary) PayloadType() PayloadType

PayloadType returns the type of payload

type PayloadString

type PayloadString struct {
	Data []byte
}

PayloadString is a string DataChannel message

func (PayloadString) PayloadType

func (p PayloadString) PayloadType() PayloadType

PayloadType returns the type of payload

type PayloadType

type PayloadType int

PayloadType are the different types of data that can be represented in a DataChannel message

func (PayloadType) String

func (p PayloadType) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL