Defines the timeout in milliseconds before a connection is considered to have been disconnected. Default value = 2000.
Unity Multiplayer defines conditions under which a connection is considered as disconnected. Disconnection can happen for the following reasons:
(1) A disconnection request was received.
(2) The connection has not received any traffic at all for a time longer than DisconnectTimeout (Note that live connections receive regular keep-alive packets, so in this case "no traffic" means not only no user traffic but also absence of any keep-alive traffic as well).
(3) Flow control determines that the time between sending packets is longer than DisconnectTimeout. Keep-alive packets are regularly delivered from peers and contain statistical information. This information includes values of packet loss due to network and peer overflow conditions. Setting NetworkDropThreshold and OverflowDropThreshold defines thresholds for flow control which can decrease packet frequency. When the time before sending the next packet is longer than DisconnectTimeout, the connection will be considered as disconnected and a disconnect event is received.
no example available in JavaScript
using UnityEngine; using UnityEngine.Networking;
public class ExampleScript : NetworkBehaviour { void Start() { ConnectionConfig myConfig = new ConnectionConfig(); myConfig.DisconnectTimeout = 5000; //5 seconds } }
Did you find this page useful? Please give it a rating: