Skip to main content
Version: 5.11.8

JoinGameServer

public bool JoinGameServer(string serverAddress, string serverPort, bool isReconnect, out ErrorInfo errorInfo);

Parameters

ValueTypeDescription
serverAddressstringIn-game server address(server address retrieved from IsGameRoomActivate)
serverPortushortIn-game server port(server port retrieved from IsGameRoomActivate)
isReconnectboolReconnection status(true)
errorInfoErrorInfoSuccess/failure information

Description

Attempts to reconnect the game room where the user was playing.

  • To reconnect properly, the third isReconnect must be true.
  • If the method is returned as true, it means the in-game server and socket are connected.
  • The actual server connection and reconnection to the game room will be performed when the user is authenticated in the in-game server. For more information on the success/failure status of reconnection, see the following success/failure status of in-game server reconnection and user authentication completion event.

Connection to the game room is established simultaneously with connection to the in-game server.
There is no need to call the JoinGameRoom method; if the JoinGameRoom method is called, an InvalidOperation error occurs.

Events returned when reconnection succeeds

Reconnected user

User who was already in the game room

Example

var bro = Backend.Match.IsGameRoomActivate();
var roomInfo = bro.GetReturnValuetoJSON();
var addr = roomInfo["serverPublicHostName"].ToString();
var port = Convert.ToUInt16(roomInfo["serverPort"].ToString());
ErrorInfo errorInfo = null;

if(JoinGameServer(addr, port, true, out errorInfo) == false)
{
// Error confirmation
return;
}

Return cases

For more information on return cases, see In-game server connection request.