From 5f474e566f89f7c5a31e96d633d19bf8b5c6ffac Mon Sep 17 00:00:00 2001 From: Logan Date: Thu, 8 Oct 2020 09:11:18 -0700 Subject: [PATCH] docs: Update connection-approval.md (#366) Give clarity what namespaces need to be included --- docs/_docs/getting-started/connection-approval.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/_docs/getting-started/connection-approval.md b/docs/_docs/getting-started/connection-approval.md index 50e45c312b..c70216946e 100644 --- a/docs/_docs/getting-started/connection-approval.md +++ b/docs/_docs/getting-started/connection-approval.md @@ -7,6 +7,9 @@ During every new connection the MLAPI performs a handshake on top of the one(s) However, when ConnectionApproval is true you are also required to provide a callback where you put your approval logic inside. (Server only) Example: ```csharp +using MLAPI; +using MLAPI.Spawning; + private void Setup() { NetworkingManager.Singleton.ConnectionApprovalCallback += ApprovalCheck; @@ -31,6 +34,8 @@ private void ApprovalCheck(byte[] connectionData, ulong clientId, MLAPI.Networki ### Connection data The connectionData parameter is any custom data of your choice that the client should send to the server. Usually, this should be some sort of ticket, room password or similar that will decide if a connection should be approved or not. The connectionData is specified on the Client side in the NetworkingConfig supplied when connecting. Example: ```csharp +using MLAPI; + NetworkingManager.Singleton.NetworkConfig.ConnectionData = System.Text.Encoding.ASCII.GetBytes("room password"); NetworkingManager.Singleton.StartClient(); ``` @@ -45,4 +50,4 @@ The MLAPI uses a callback system in order to allow for external validation. For If connection approval is enabled. Any messages sent before a connection is setup are silently ignored. #### Connection Data -If Encryption is enabled, the connection handshake with the buffer will be encrypted AND authenticated. (AES-256 encryption and HMAC-SHA-256 authentication). Please note that if the key exchange is not signed, a man in the middle attack can be done. If you plan on sending authentication tokens such as steam tickets. It's strongly suggested that you sign the handshake. \ No newline at end of file +If Encryption is enabled, the connection handshake with the buffer will be encrypted AND authenticated. (AES-256 encryption and HMAC-SHA-256 authentication). Please note that if the key exchange is not signed, a man in the middle attack can be done. If you plan on sending authentication tokens such as steam tickets. It's strongly suggested that you sign the handshake.