Signal2
Signal support.
SceneMultiplayer.swift:745class Signal2
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 (20) members.
Types
class Signal1
Signal support.
class Signal3
Signal support.
Type members
Instance members
var allowObjectDecoding: Bool
If
true
, the MultiplayerAPI will allow encoding and decoding of object during RPCs.var authCallback: Callable
The callback to execute when when receiving authentication data sent via
sendAuth(id:data:)
. If theCallable
is empty (default), peers will be automatically accepted as soon as they connect.var authTimeout: Double
If set to a value greater than
0.0
, the maximum amount of time peers can stay in the authenticating state, after which the authentication will automatically fail. See the [signal peer_authenticating] and [signal peer_authentication_failed] signals.var maxDeltaPacketSize: Int32
Maximum size of each delta packet. Higher values increase the chance of receiving full updates in a single frame, but also the chance of causing networking congestion (higher latency, disconnections). See
MultiplayerSynchronizer
.var maxSyncPacketSize: Int32
Maximum size of each synchronization packet. Higher values increase the chance of receiving full updates in a single frame, but also the chance of packet loss. See
MultiplayerSynchronizer
.var peerAuthenticating: Signal1
Emitted when this MultiplayerAPI’s
multiplayerPeer
connects to a new peer and a validauthCallback
is set. In this case, the [signal MultiplayerAPI.peer_connected] will not be emitted untilcompleteAuth(id:)
is called with given peerid
. While in this state, the peer will not be included in the list returned bygetPeers
(but in the one returned bygetAuthenticatingPeers
), and only authentication data will be sent or received. SeesendAuth(id:data:)
for sending authentication data.var peerAuthenticationFailed: Signal2
Emitted when this MultiplayerAPI’s
multiplayerPeer
disconnects from a peer for which authentication had not yet completed. See [signal peer_authenticating].var peerPacket: Signal3
Emitted when this MultiplayerAPI’s
multiplayerPeer
receives apacket
with custom data (seesendBytes(_:id:mode:channel:)
). ID is the peer ID of the peer that sent the packet.var refuseNewConnections: Bool
If
true
, the MultiplayerAPI’smultiplayerPeer
refuses new incoming connections.var rootPath: NodePath
The root path to use for RPCs and replication. Instead of an absolute path, a relative path will be used to find the node upon which the RPC should be executed.
var serverRelay: Bool
Enable or disable the server feature that notifies clients of other peers’ connection/disconnection, and relays messages between them. When this option is
false
, clients won’t be automatically notified of other peers and won’t be able to send them packets through the server.func clear(
) Clears the current SceneMultiplayer network state (you shouldn’t call this unless you know what you are doing).
func completeAuth(id: Int32
) -> GodotError Mark the authentication step as completed for the remote peer identified by
id
. The [signal MultiplayerAPI.peer_connected] signal will be emitted for this peer once the remote side also completes the authentication. No further authentication messages are expected to be received from this peer.func disconnectPeer(id: Int32
) Disconnects the peer identified by
id
, removing it from the list of connected peers, and closing the underlying connection with it.func getAuthenticatingPeers(
) -> PackedInt32Array Returns the IDs of the peers currently trying to authenticate with this
MultiplayerAPI
.func sendAuth(id: Int32, data: PackedByteArray
) -> GodotError Sends the specified
data
to the remote peer identified byid
as part of an authentication message. This can be used to authenticate peers, and control when [signal MultiplayerAPI.peer_connected] is emitted (and the remote peer accepted as one of the connected peers).func sendBytes(PackedByteArray, id: Int32, mode: MultiplayerPeer.TransferMode, channel: Int32
) -> GodotError Sends the given raw
bytes
to a specific peer identified byid
(seesetTargetPeer(id:)
). Default ID is0
, i.e. broadcast to all peers.
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 (_ id: Int64) -> ()
) -> 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:_:)