Enumerationmigueldeicaza.swiftgodot 0.46.0SwiftGodot
SignalingState
WebRTCPeerConnection.swift:84enum SignalingState
Cases
case stable
There is no ongoing exchange of offer and answer underway. This may mean that the
WebRTCPeerConnection
is new (.stateNew) or that negotiation is complete and a connection has been established (.stateConnected).case haveLocalOffer
The local peer has called
setLocalDescription(type:sdp:)
, passing in SDP representing an offer (usually created by callingcreateOffer
), and the offer has been applied successfully.case haveRemoteOffer
The remote peer has created an offer and used the signaling server to deliver it to the local peer, which has set the offer as the remote description by calling
setRemoteDescription(type:sdp:)
.case haveLocalPranswer
The offer sent by the remote peer has been applied and an answer has been created and applied by calling
setLocalDescription(type:sdp:)
. This provisional answer describes the supported media formats and so forth, but may not have a complete set of ICE candidates included. Further candidates will be delivered separately later.case haveRemotePranswer
A provisional answer has been received and successfully applied in response to an offer previously sent and established by calling
setLocalDescription(type:sdp:)
.case closed
The
WebRTCPeerConnection
has been closed.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (21) members.
Types
enum ConnectionState
enum GatheringState
class Signal1
Signal support.
class Signal2
Signal support.
class Signal3
Signal support.
Type members
static func setDefaultExtension(extensionClass: StringName
) Sets the
extensionClass
as the defaultWebRTCPeerConnectionExtension
returned when creating a newWebRTCPeerConnection
.class var godotClassName: StringName
Instance members
var dataChannelReceived: Signal3
Emitted when a new in-band channel is received, i.e. when the channel was created with
negotiated: false
(default).var iceCandidateCreated: Signal2
Emitted when a new ICE candidate has been created. The three parameters are meant to be passed to the remote peer over the signaling server.
var sessionDescriptionCreated: Signal1
Emitted after a successful call to
createOffer
orsetRemoteDescription(type:sdp:)
(when it generates an answer). The parameters are meant to be passed tosetLocalDescription(type:sdp:)
on this object, and sent to the remote peer over the signaling server.func addIceCandidate(media: String, index: Int32, name: String
) -> GodotError Add an ice candidate generated by a remote peer (and received over the signaling server). See [signal ice_candidate_created].
func close(
) Close the peer connection and all data channels associated with it.
func createDataChannel(label: String, options: GDictionary
) -> WebRTCDataChannel? Returns a new
WebRTCDataChannel
(ornull
on failure) with givenlabel
and optionally configured via theoptions
dictionary. This method can only be called when the connection is in state .stateNew.func createOffer(
) -> GodotError 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.func getConnectionState(
) -> WebRTCPeerConnection.ConnectionState Returns the connection state. See
ConnectionState
.func getGatheringState(
) -> WebRTCPeerConnection.GatheringState Returns the ICE
GatheringState
of the connection. This lets you detect, for example, when collection of ICE candidates has finished.func getSignalingState(
) -> WebRTCPeerConnection.SignalingState Returns the signaling state on the local end of the connection while connecting or reconnecting to another peer.
func initialize(configuration: GDictionary
) -> GodotError Re-initialize this peer connection, closing any previously active connection, and going back to state .stateNew. A dictionary of
configuration
options can be passed to configure the peer connection.func poll(
) -> GodotError Call this method frequently (e.g. in
_process(delta:)
or_physicsProcess(delta:)
) to properly receive signals.func setLocalDescription(type: String, sdp: String
) -> GodotError Sets the SDP description of the local peer. This should be called in response to [signal session_description_created].
func setRemoteDescription(type: String, sdp: String
) -> GodotError 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.
Citizens in SwiftGodot
Conformances
protocol CaseIterable
A type that provides a collection of all of its values.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
Type members
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.