Navigation

    Colyseus
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Users
    1. Home
    2. Unelith
    Unelith

    Unelith

    @Unelith

    Chat Follow Unfollow
    0
    Reputation
    2
    Posts
    270
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    • Profile
    • More
      • Continue chat with Unelith
      • Flag Profile
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups
    Unelith Follow

    Posts made by Unelith

    RE: CSAMatchMakeException only thrown sometimes in JoinById

    I have the newest Colyseus SDK version in 0.14.8

    posted in Questions & Help •
    CSAMatchMakeException only thrown sometimes in JoinById

    I'm using the Unity client, with Unity version 2020.3.19f1.

    I'm throwing ServerError server side in onAuth, but it's only re-thrown sometimes on the client, as opposed to every time. Most of the time, the async task will just keep hanging there forever and neither resolve nor throw.

    The first attempt usually throws correctly (but not quite every single time).

    Below is the result of attempting the same action twice in a row, with the same parameters:

    Unity log:

    0_1634506461219_e39e2b98-cbf1-4587-a73d-ac9ab597798e-obraz.png

    Server log:

    0_1634506586096_32b62a36-11c0-473b-8958-1efb0487fd5c-obraz.png


    Client-side code:

    try {
    	// Connect to lobby room
    	var _room = await colyseus.JoinById<LobbyState>(colyseusSettings.lobbyRoomId, new Dictionary<string, object>{
    		{ "username", _credentials.username },
    		{ "password", _credentials.password }
    	});
    } catch ( CSAMatchMakeException ex ) {
    	if (ex.Code == 401) {
    		throw new WrongCredentialsException(ex.Message, _credentials.username, _credentials.password);
    	} else if (ex.Code >= 500) {
    		throw new LoginServerException(ex.Message);
    	} else {
    		throw new LoginUnknownException(ex.Message);
    	}
    } catch ( Exception ex ) {
    	throw new LoginUnknownException(ex.Message);
    }
    

    Server-side code:

    if (!account) {
        log.debug({ roomType: 'LobbyRoom', roomId: this.roomId, client, username: options.username }, '[LobbyRoom] Client authentication failed - no matching account for provided credentials');
        throw new ServerError(401, 'No matching account found for username and password');
    }
    

    The entire onAuth method is async and returns a Promise<T>.

    posted in Questions & Help •