Kanda Foundation 0.8.0
Loading...
Searching...
No Matches
Connection Monitoring

The Kanda SDK provides several connection monitoring capabilities to help you manage and respond to various network-related events in your application. This functionality is designed to work well with downstream SDK packages.

Overview

Connection monitoring in the Kanda SDK consists of three main features:

  1. Disconnect Monitoring
  2. Timeout Monitoring
  3. Player Count Monitoring

These systems generate app events that you can listen for and react to in downstream logic, providing you with real-time information about the state of client connections.

Disconnect Monitoring

The disconnect monitoring system tracks when clients disconnect from the server. It detects various disconnect scenarios and provides information about the reason for disconnection.

Key Features:

  • Detects client disconnections
  • Provides the reason for disconnection (e.g., connection close, timeout, etc.)
  • Generates an app event containing disconnect information

Timeout Monitoring

The timeout monitoring system keeps track of clients that are in the process of connecting. If a client takes too long to establish a connection, the system will generate a timeout event.

Key Features:

  • Monitors clients in the connecting state
  • Uses a configurable timeout period
  • Generates an app event when a client connection attempt times out

Player Count Monitoring

The player count monitoring system tracks the number of active players in a session. This is particularly useful for dedicated server scenarios where you need to report the current player count to a game server hosting service.

Key Features:

  • Tracks the number of in-game players
  • Updates player count at a regular interval
  • Reports player count to the Unity Game Server Hosting service (for dedicated servers only)

Using App Events

Most of the monitoring systems generate specific app events that you can query for in downstream logic. These events include:

  • ClientDisconnectEventData: Contains information about a client disconnection
  • ClientTimeoutEventData: Indicates that a client connection attempt has timed out

To use these events, you can create systems that react to these app events and implement the appropriate logic.