Skip to main content

RTCDataChannelInit

Struct RTCDataChannelInit 

Source
pub struct RTCDataChannelInit {
    pub ordered: bool,
    pub max_packet_life_time: Option<u16>,
    pub max_retransmits: Option<u16>,
    pub protocol: String,
    pub negotiated: Option<StreamId>,
}
Expand description

Dictionary for configuring properties of an RTCDataChannel.

The RTCDataChannelInit dictionary is used to configure the properties of a data channel when creating it via RTCPeerConnection::create_data_channel.

§Specifications

§Examples

use rtc::data_channel::RTCDataChannelInit;

let init = RTCDataChannelInit {
    ordered: false,
    max_retransmits: Some(3),
    ..Default::default()
};

Fields§

§ordered: bool

If set to false, data is allowed to be delivered out of order.

The default value of true guarantees that data will be delivered in order. Setting this to false may improve latency at the cost of ordering guarantees.

Corresponds to the ordered attribute in the W3C specification.

§max_packet_life_time: Option<u16>

Limits the time (in milliseconds) during which the channel will transmit or retransmit data if not acknowledged.

If set, this value may be clamped to the maximum value supported by the user agent. This option cannot be used together with max_retransmits.

Corresponds to the maxPacketLifeTime attribute in the W3C specification.

§max_retransmits: Option<u16>

Limits the number of times the channel will retransmit data if not successfully delivered.

If set, this value may be clamped to the maximum value supported by the user agent. This option cannot be used together with max_packet_life_time.

Corresponds to the maxRetransmits attribute in the W3C specification.

§protocol: String

The name of the subprotocol used for this channel.

An empty string indicates no subprotocol is being used. The default is an empty string.

Corresponds to the protocol attribute in the W3C specification.

§negotiated: Option<StreamId>

If Some(id), the data channel is negotiated out-of-band with the given stream identifier.

When set to Some(id), the application is responsible for negotiating the channel and creating a matching data channel with the same id on the remote peer. The data channel will not be announced in-band.

When set to None (the default), the user agent will announce the channel in-band and automatically create a corresponding data channel on the remote peer.

Corresponds to the negotiated and id attributes in the W3C specification.

Trait Implementations§

Source§

impl Clone for RTCDataChannelInit

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for RTCDataChannelInit

Source§

fn default() -> Self

The defaults defined by W3C RTCDataChannelInit.

Note ordered: it defaults to true, so ..Default::default() yields an ordered, reliable channel — what an application asking for “a plain data channel” expects. A derived Default would make it false, and an unordered channel does more than reorder application messages: unordered chunks bypass SCTP’s ordered-delivery queue, so a first message can overtake the DATA_CHANNEL_OPEN sent on the same stream and be dropped by the peer as data on a stream it has not accepted yet.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Returns the layout of the type.
Source§

impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
where T: SharedNiching<N1, N2>, N1: Niching<T>, N2: Niching<T>,

Source§

unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool

Returns whether the given value has been niched. Read more
Source§

fn resolve_niched(out: Place<NichedOption<T, N1>>)

Writes data to out indicating that a T is niched.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.