Navigation

  • Recent
  • Tags
  • Users
  • Search
  • Login
Colyseus
  • Login
  • Search
  • Recent
  • Tags
  • Users

Documentation GitHub

We're migrating to GitHub Discussions. This forum does not accept new registrations since April 6, 2023.
  1. Home
  2. aldrakos
  3. Posts
  • Profile
  • More
    • Continue chat with aldrakos
    • Flag Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

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 • 28 Jun 2019, 23:54

© 2023 Endel Dreyer