As of April 2023 Peer-to-Peer Networking is deprecated and is no longer included in the list of available Platform APIs for integration. For more information check the blog post here.
Third-party solutions, such as Photon, can be used as an alternative to implement P2P networking in your app. For an example of how Photon, and other third-party solutions integrate with the Platform API, check here.
Peer-to-Peer (P2P) networking allows your app to establish a connection and send data directly between users.
There are a number of uses for P2P networking. Some common implementations include, using P2P to exchange chat messages between users, updating gameplay data in lower latency, or update avatar positions in real-time. Our P2P service connects users to exchange data directly.
The Meta Horizon platform P2P allows you to choose between two send policies to transmit data depending on your use-case and the needs of your app.
Reliable connections transmit data that will be delivered once and in the order that messages are sent. The networking layer retries until each message is acknowledged by the peer. Outgoing messages are buffered until a working connection to the peer is established. Reliable messages are useful when using P2P to send text chat messages that need to be delivered once and in the order that the user sent them, but not necessarily instantaneously.
Unreliable connections transmit data as best-effort, but cannot guarantee delivery in a specific order or time-frame. Any messages sent before a connected state is established will be dropped. Unreliable messages are useful when you’re using P2P to update game data in realtime and transmitting data quickly is more important than guaranteeing delivery once and in order. Note that messages sent over unreliable connections should be limited to 1200 bytes.
Note
P2P data may be routed through relay servers located inside Meta's infrastructure when connecting to client devices that are behind network address translation (NAT), if a connection cannot be established from their detected external address. The VoIP data passing through a relay server is not inspected any more than is necessary to forward to the recipient; nor is it retained.
This is a Platform SDK feature requiring Data Use Checkup
To use this or any other Platform SDK feature, you must complete a Data Use Checkup (DUC). The DUC ensures that you comply with Developer Policies. It requires an administrator from your organization to certify that your use of user data aligns with platform guidelines. Until the app review team reviews and approves your DUC, platform features are only available for test users.
Integrate Peer-to-Peer Networking
P2P networking between users is handled by Unreal’s UNetDriver and most situations do not require any additional integration. To enable P2P ensure that the following is added to your DefaultEngine.ini file.