StrixNetworkJoinRandomRoom Method (RoomMemberProperties, RoomJoinEventHandler, FailureEventHandler, RequestConfig) |
Namespace: SoftGear.Strix.Unity.Runtime
public void JoinRandomRoom( RoomMemberProperties memberProperties, RoomJoinEventHandler handler, FailureEventHandler failureHandler, RequestConfig config = null )
ErrorCodeException |
Strix error which can be further separated by an error code:
| ||||||||||||||||||||||||||||||
SocketException | An error occurred when attempting to access the socket. | ||||||||||||||||||||||||||||||
WebException |
There has been an error when connecting to the authentication server. It's either an HTTP error such as 404/Not Found, or a network error like failure to resolve a DNS entry, a socket error, etc. | ||||||||||||||||||||||||||||||
ArgumentException |
When using an authentication server this error can happen if the server returns an invalid authorization token. It could be an invalid UTF-8 string or an invalid JSON. | ||||||||||||||||||||||||||||||
Exception | This can happen if the address for the given host couldn't be resolved when establishing socket connection. |
using SoftGear.Strix.Unity.Runtime; using System.Collections.Generic; using UnityEngine; public class StrixJoinRandomRoomExample : MonoBehaviour { void Start() { var strixNetwork = StrixNetwork.instance; strixNetwork.applicationId = "00000000-0000-0000-0000-000000000000"; strixNetwork.ConnectMasterServer( host: "0123456789abcdef01234567.game.strixcloud.net", connectEventHandler: _ => { Debug.Log("Connection established."); strixNetwork.JoinRandomRoom( memberProperties: new RoomMemberProperties { name = "My Player Name", properties = new Dictionary<string, object> { { "hairColor", "green" } } }, handler: __ => Debug.Log("Room joined."), failureHandler: joinError => Debug.LogError("Joining random room failed. Reason: " + joinError.cause) ); }, errorEventHandler: connectError => Debug.LogError("Connection failed. Reason: " + connectError.cause) ); } }