Defines the duration in milliseconds between keep-alive packets, also known as pings. Default value = 500.
The ping frequency should be long enough to accumulate good statistics and short enough to compare with DisconnectTimeout. A good guideline is to have more than 3 pings per disconnect timeout, and more than 5 messages per ping. For example, with a DisconnectTimeout of 2000ms, a PingTimeout of 500ms works well.
using UnityEngine; using UnityEngine.Networking;
public class ExampleScript : MonoBehaviour { void Start() { ConnectionConfig myConfig = new ConnectionConfig(); myConfig.AddChannel(QosType.Unreliable); myConfig.AddChannel(QosType.UnreliableFragmented); myConfig.PingTimeout = 500; } }