WebRTCPeerConnection

Interface to a WebRTC peer connection.

A WebRTC connection between the local computer and a remote peer. Provides an interface to connect, maintain and monitor the connection. Setting up a WebRTC connection between two peers from now on) may not seem a trivial task, but it can be broken down into 3 main steps: - The peer that wants to initiate the connection (A from now on) creates an offer and send it to the other peer (B from now on). - B receives the offer, generate and answer, and sends it to A). - A and B then generates and exchange ICE candidates with each other. After these steps, the connection should become connected. Keep on reading or look into the tutorial for more information.

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Enums

ConnectionState
enum ConnectionState
Constants
enum Constants

Functions

addIceCandidate
GodotError addIceCandidate(String media, long index, String name)

Add an ice candidate generated by a remote peer (and received over the signaling server). See iceCandidateCreated.

close
void close()

Close the peer connection and all data channels associated with it. Note, you cannot reuse this object for a new connection unless you call initialize.

createDataChannel
Ref!WebRTCDataChannel createDataChannel(String label, Dictionary options)

Returns a new WebRTCDataChannel (or null on failure) with given label and optionally configured via the options dictionary. This method can only be called when the connection is in state constant STATE_NEW. There are two ways to create a working data channel: either call createDataChannel on only one of the peer and listen to dataChannelReceived on the other, or call createDataChannel on both peers, with the same values, and the negotiated option set to true. Valid options are:

createOffer
GodotError createOffer()

Creates a new SDP offer to start a WebRTC connection with a remote peer. At least one WebRTCDataChannel must have been created before calling this method. If this functions returns constant OK, sessionDescriptionCreated will be called when the session is ready to be sent.

getConnectionState
WebRTCPeerConnection.ConnectionState getConnectionState()

Returns the connection state. See connectionstate.

initialize
GodotError initialize(Dictionary configuration)

Re-initialize this peer connection, closing any previously active connection, and going back to state constant STATE_NEW. A dictionary of options can be passed to configure the peer connection. Valid options are:

opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(WebRTCPeerConnection other)
opEquals
bool opEquals(typeof(null) n)
poll
GodotError poll()

Call this method frequently (e.g. in Node._process or Node._physicsProcess) to properly receive signals.

setLocalDescription
GodotError setLocalDescription(String type, String sdp)

Sets the SDP description of the local peer. This should be called in response to sessionDescriptionCreated. After calling this function the peer will start emitting iceCandidateCreated (unless an error different from constant OK is returned).

setRemoteDescription
GodotError setRemoteDescription(String type, String sdp)

Sets the SDP description of the remote peer. This should be called with the values generated by a remote peer and received over the signaling server. If type is offer the peer will emit sessionDescriptionCreated with the appropriate answer. If type is answer the peer will start emitting iceCandidateCreated.

toHash
size_t toHash()

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Static functions

_new
WebRTCPeerConnection _new()

Construct a new instance of WebRTCPeerConnection. Note: use memnew!WebRTCPeerConnection instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta