지원 프로그램
home
슬기로운 데모생활
home

4. Connect to Matchmaking Server

태그

Server Connection API

Connect to the matchmaking server with the SDK.Connect method.
using Stove.PCSDK.NET.Matchmaking; // nickname string nickname = user.Nickname; SDK.Connect(accessToken, UID, nickname);
Plain Text
복사

Server connection callback

To receive a callback for server connection, you must register a delegate in advance. When the SDK.Connect method is processed, it calls the nConnect callback.
// Register the server connection delegate SDK.EventConnect += GameObj.OnConnect; private void OnConnect(StovePCMatchmakingError error) { // successful connection to matchmaking server // Process the next game logic, such as moving the scene if (error.result == StovePCMatchmakingResult.NO_ERROR) { GameManager.Instance.LoadModScene(); } // Failed to connect to matchmaking server // error handling else { StringBuilder sb = new StringBuilder(); // error code sb.AppendFormat(" - fail code : {0}", error.result); // If there is a specific error sb.AppendFormat(" - fail message : {0}", error.message); Debug.Log(sb.ToString()); } }
Plain Text
복사
error.result(error code) can be checked in StovePCMatchmakingResult. It passes more specific error content to error.message.