Navigation

    Colyseus
    • Login
    • Search
    • Recent
    • Tags
    • Users
    1. Home
    2. aldrakos
    3. Best
    • Profile
    • More
      • Continue chat with aldrakos
      • Flag Profile
      • Following
      • Followers
      • Topics
      • Posts
      • Best
      • Groups

    Best posts made by aldrakos

    How to send specific error message on requestJoin fail?

    Hello, I am building a lobby where a player creates a room and the rest of the players join.

    There are various cases that a users cannot join the created room, for example he is already joined, he's entered a wrong password, or the game has already started, etc.

    I check and return false on the requestJoin method on these cases, but I can't see a way to also send an explanation back to the user: using this.send(client, {}) does not work, since the user is not yet connected so no client yet. Is there a way to send a specific error message to the user? Right now he receives a generic error on the client.onError listener, "Failed to join invalid room XXXX".

    Could we either have an option to return an object on requestJoin instead of boolean that contains both ( for example { success: false, message: "Wrong password entered"} ) or influence the error message that the client will get from inside the requestJoin method? The message to return could be pre-defined so the client API also knows that request to join is denied either on response === false, or on response.success === false

    PS: Also saw this is an open issue on github as well: #226, but I thought I'd post here as well, as this isn't really an issue or a bug

    posted in Questions & Help •