Signal3
Signal support.
WebRTCPeerConnection.swift:632class Signal3
Use the connect(flags:_:)
method to connect to the signal on the container object, and disconnect(_:)
to drop the connection.
You can also await the emitted
property for waiting for a single emission of the signal.
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.
enum SignalingState
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
SignalingState
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
Instance members
var emitted: Void
You can await this property to wait for the signal to be emitted once
func connect(flags: Object.ConnectFlags, @escaping (_ channel: WebRTCDataChannel) -> ()
) -> Object Connects the signal to the specified callback
func disconnect(Object
) Disconnects a signal that was previously connected, the return value from calling
connect(flags:_:)