Contents

NetworkCompatibilityToken

An opaque token used to check the networking compatibility between two peers in a multipeer connection.

Declaration

final class NetworkCompatibilityToken

Overview

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 compatibilityWith(_:) on NetworkCompatibilityToken.local. If compatibilityWith(_:) returns NetworkCompatibilityToken.Compatibility.compatible, the client and host can sync and it’s safe to proceed with the connection. If compatibilityWith(_:) returns any other value, the client that’s attempting to connect is incompatible and should be ignored.

A client running a MCNearbyServiceAdvertiser, for example, writes its own token into its discoveryInfo dictionary. When the host (running a 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 MCSession.

Topics

Retrieving tokens

Checking compatibility

Serializing tokens

Enumerations

See Also

Multipeer synchronization