Legacy Documentation: Version 2017.1 (Go to current version)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

NetworkMatch.DropConnection

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public function DropConnection(netId: Networking.Types.NetworkID, dropNodeId: Networking.Types.NodeID, requestDomain: int, callback: Networking.Match.NetworkMatch.BasicResponseDelegate): Coroutine;
public Coroutine DropConnection(Networking.Types.NetworkID netId, Networking.Types.NodeID dropNodeId, int requestDomain, Networking.Match.NetworkMatch.BasicResponseDelegate callback);

Parameters

netId The NetworkID of the match the client to drop belongs to.
dropNodeId The NodeID of the client to drop inside the specified match.
requestDomain The request domain for this request. Only requests in the same domain can interface with each other. For example if a NetworkMatch.CreateMatch is made with domain 1, only ListMatches that also specify domain 1 will find that match. Use this value to silo different (possibly incompatible) client versions.
callback The callback to invoke when the request completes.

Returns

Coroutine This function is asynchronous and will complete at some point in the future, when the coroutine has finished communicating with the service backend.

Description

A function to allow an individual client to be dropped from a match.

This function automatically calls OnClientDisconnect to tell the matchmaker to clean up the client state in the Unity Multiplayer service. When a client is cleaned up it will be disconnected from the relay server and will no longer be part of the current match.

This function is auth token protected. The auth token is generated when a client creates or joins a match. This function will only succeed if the caller is the client being dropped or is the match host (which is a match administrator). All other callers will be denied access.

no example available in JavaScript
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Networking.Match;

public class ExampleScript : MonoBehaviour { public NetworkID netId;

void Start() { NetworkManager.singleton.StartMatchMaker(); NetworkManager.singleton.matchMaker.DropConnection(netId, NodeId.Invalid, 0, OnMatchDropConnection); }

public void OnMatchDropConnection(bool success, string extendedInfo) { // ... } }

Did you find this page useful? Please give it a rating: