ドキュメント

Multiplayer Services SDK

All Services

Multiplayer Services SDK

Enable DTLS encryption

Configure your Relay client to use Datagram Transport Layer Security for encrypted connections.
読み終わるまでの所要時間 1 分最終更新 2ヶ月前

Enabling DTLS encryption only enables encryption of message. Other Relay behavior, such as timeouts, remains the same.
Relay supports DTLS encryption of all UDP communication to and from the Relay servers. Set the Relay server
RelayProtocol
to
DTLS
when creating an allocation as a host player to enable DTLS encryption.
Players joining the host player can use a different connection type than the host player. However, most gaming platforms required encrypted connections.
The following code snippet shows how to create sessions with DTLS encryption:
using Unity.Services.Multiplayer;// As host: create a session with DTLS encryption explicitly setvar session = await MultiplayerService.Instance.CreateSessionAsync( new SessionOptions { MaxPlayers = 4 } .WithRelayNetwork() .WithNetworkOptions(new NetworkOptions { RelayProtocol = RelayProtocol.DTLS }));Debug.Log($"Session created with join code: {session.Code}");
The following code snippet shows how to join a session with DTLS encryption:
// As client: join by code with DTLSvar session = await MultiplayerService.Instance.JoinSessionByCodeAsync( joinCode, new JoinSessionOptions() .WithNetworkOptions(new NetworkOptions { RelayProtocol = RelayProtocol.DTLS }));