Interface RTCDataChannel
binaryType: BinaryType;
bufferedAmount: number;
bufferedAmountLowThreshold: number;
id: number | null;
label: string;
maxPacketLifeTime: number | null;
maxRetransmits: number | null;
negotiated: boolean;
onbufferedamountlow: ((this: RTCDataChannel, ev: Event) => any) | null;
onclose: ((this: RTCDataChannel, ev: Event) => any) | null;
onclosing: ((this: RTCDataChannel, ev: Event) => any) | null;
onerror: ((this: RTCDataChannel, ev: RTCErrorEvent) => any) | null;
onmessage: ((this: RTCDataChannel, ev: MessageEvent) => any) | null;
onopen: ((this: RTCDataChannel, ev: Event) => any) | null;
ordered: boolean;
protocol: string;
readyState: RTCDataChannelState;
addEventListener<K extends keyof RTCDataChannelEventMap>(
type: K,
listener: (this: RTCDataChannel, ev: RTCDataChannelEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;
close(): void;
dispatchEvent(event: Event): boolean;
removeEventListener<K extends keyof RTCDataChannelEventMap>(
type: K,
listener: (this: RTCDataChannel, ev: RTCDataChannelEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;
send(data: string): void;
send(data: Blob): void;
send(data: ArrayBuffer): void;
send(data: ArrayBufferView<ArrayBuffer>): void;
}
Hierarchy
- EventTarget
- RTCDataChannel
Properties
binaryType
The property binaryType on the the type of object which should be used to represent binary data received on the RTCDataChannel.
ReadonlybufferedAmount
The read-only RTCDataChannel property bufferedAmount returns the number of bytes of data currently queued to be sent over the data channel.
bufferedAmountLowThreshold
The RTCDataChannel property bufferedAmountLowThreshold is used to specify the number of bytes of buffered outgoing data that is considered 'low.' The default value is 0.
Readonlyid
The read-only RTCDataChannel property id returns an ID number (between 0 and 65,534) which uniquely identifies the RTCDataChannel.
Readonlylabel
The read-only RTCDataChannel property label returns a string containing a name describing the data channel.
ReadonlymaxPacketLifeTime
The read-only RTCDataChannel property maxPacketLifeTime returns the amount of time, in milliseconds, the browser is allowed to take to attempt to transmit a message, as set when the data channel was created, or null.
ReadonlymaxRetransmits
The read-only RTCDataChannel property maxRetransmits returns the maximum number of times the browser should try to retransmit a message before giving up, as set when the data channel was created, or null, which indicates that there is no maximum.
Readonlynegotiated
The read-only RTCDataChannel property negotiated indicates whether the (true) or by the WebRTC layer (false).
onbufferedamountlow
onclose
onclosing
onerror
onmessage
onopen
Readonlyordered
The read-only RTCDataChannel property ordered indicates whether or not the data channel guarantees in-order delivery of messages; the default is true, which indicates that the data channel is indeed ordered.
Readonlyprotocol
The read-only RTCDataChannel property protocol returns a string containing the name of the subprotocol in use.
ReadonlyreadyState
The read-only RTCDataChannel property readyState returns a string which indicates the state of the data channel's underlying data connection.
Methods
addEventListener
- addEventListener<K extends keyof RTCDataChannelEventMap>(
type: K,
listener: (this: RTCDataChannel, ev: RTCDataChannelEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Type Parameters
- K extends keyof RTCDataChannelEventMap
Parameters
- type: K
- listener: (this: RTCDataChannel, ev: RTCDataChannelEventMap[K]) => any
Optionaloptions: boolean | AddEventListenerOptions
Returns void
- addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | AddEventListenerOptions
Returns void
close
The
RTCDataChannel.close()method closes the closure of the channel.Returns void
dispatchEvent
The
dispatchEvent()method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.Parameters
- event: Event
Returns boolean
removeEventListener
- removeEventListener<K extends keyof RTCDataChannelEventMap>(
type: K,
listener: (this: RTCDataChannel, ev: RTCDataChannelEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.Type Parameters
- K extends keyof RTCDataChannelEventMap
Parameters
- type: K
- listener: (this: RTCDataChannel, ev: RTCDataChannelEventMap[K]) => any
Optionaloptions: boolean | EventListenerOptions
Returns void
- removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | EventListenerOptions
Returns void
send
Parameters
- data: Blob
Returns void
Parameters
- data: ArrayBuffer
Returns void
Parameters
- data: ArrayBufferView<ArrayBuffer>
Returns void
The
RTCDataChannelinterface represents a network channel which can be used for bidirectional peer-to-peer transfers of arbitrary data.MDN Reference