//////////
Search
Duplicate

5. Terminate Connection from Matchmaking Server

태그

Server Connection Termination API

Disconnect from the matchmaking server with the SDK.Disconnect method.
using Stove.PCSDK.NET.Matchmaking; SDK.Disconnect()
Plain Text
복사

Server connection termination callback

To receive a callback for server connection termination, you must register a delegate in advance. When the SDK.Disconnect method is successfully processed. It calls the OnDisconnect callback.
using Stove.PCSDK.NET.Matchmaking; // Register the server connection termination delegate SDK.EventDisconnect += GameObj.OnDisconnect; // Close the matchmaking server connection private void OnDisconnect(StovePCMatchmakingError error, StovePCMatchmakingDisconnectCode code) { switch (code) { // When the connection is terminated by calling the Disconnect API case StovePCMatchmakingDisconnectCode.DISCONNECT_CLIENT: break; // Close the client connection from the matchmaking server case StovePCMatchmakingDisconnectCode.DISCONNECT_SERVER: break; // disconnected due to ping timeout (network unstable) case StovePCMatchmakingDisconnectCode.DISCONNECT_BY_HOST: break; // Close connection due to duplicate login case StovePCMatchmakingDisconnectCode.DISCONNECT_CONFLICT: break; } //Process the following game logic, such as moving the scene }
Plain Text
복사
code (exit code) can be found in ‘StovePCMatchmakingDisconnectCode’. It passes more specific error content to error.message.

Additional information

Since it may terminate the connection from the server due to regular maintenance, etc., it is necessary to check the connection termination code. Suppose you log in as the same User in another launcher. In that case, it will terminate the current connection, so appropriate handling is required.