One Logo Pool Ball
RealityFoundation · IOS API REFERENCE

NetworkCompatibilityToken

class · iOS 13.4+ · SDK 27.1

final class NetworkCompatibilityToken

An opaque token used to check the networking compatibility between two peers in a multipeer connection. ``RealityKit`` apps running on incompatible versions of RealityKit can’t connect and sync over the network. Use ``NetworkCompatibilityToken`` to check if two peers can synchronize ``RealityKit`` scenes over the network. With this class, host applications can prevent incompatible clients from joining. Client apps send a copy of their token to the host when attempting to connect to a host app. The host deserializes that token and calls ``NetworkCompatibilityToken/compatibilityWith(_:)`` on ``NetworkCompatibilityToken``.``NetworkCompatibilityToken/local``. If ``NetworkCompatibilityToken/compatibilityWith(_:)`` returns ``NetworkCompatibilityToken/Compatibility/compatible``, the client and host can sync and it’s safe to proceed with the connection. If ``NetworkCompatibilityToken/compatibilityWith(_:)`` returns any other value, the client that’s attempting to connect is incompatible and should be ignored. A client running a <doc://com.apple.documentation/documentation/multipeerconnectivity/mcnearbyserviceadvertiser>, for example, writes its own token into its <doc://com.apple.documentation/documentation/multipeerconnectivity/mcnearbyserviceadvertiser/1406967-discoveryinfo> dictionary. When the host (running a <doc://com.apple.documentation/documentation/multipeerconnectivity/mcnearbyservicebrowser>) discovers that client, it deserializes the client’s token from the `discoverInfo` dictionary and uses it to check compatibility before inviting the client to the <doc://com.apple.documentation/documentation/multipeerconnectivity/mcsession>. - Note: Even if two peers are compatible, scene synchronization can fail for other reasons, such as packet corruption or a poor network connection.

Members (2)

method · iOS 13.4+

compatibilityWith

TypeScript
compatibilityWith(otherToken: NetworkCompatibilityToken): NetworkCompatibilityToken_Compatibility
Swift declaration
final func compatibilityWith(_ otherToken: NetworkCompatibilityToken) -> NetworkCompatibilityToken.Compatibility

Compares network compatibility tokens between the local device and another device. - Parameters: - otherToken: The token for the remote client against which the local device checks compatibility - Returns: Returns ``NetworkCompatibilityToken/Compatibility/compatible`` if the local client and the remote client represented by `otherToken` can be synced. Any other result indicates that the two devices are incompatible and you shouldn’t proceed with the connection.

get · iOS 13.4+

local

TypeScript
static get local(): NetworkCompatibilityToken
Swift declaration
static let local: NetworkCompatibilityToken

A token containing the local peer’s networking compatibility info.

Skipped declarations

No declarations were skipped in this snapshot.

All RealityFoundation types →