8000 Proposal: Improve match-making routine · Issue #176 · colyseus/colyseus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Proposal: Improve match-making routine #176
Closed
@endel

Description

@endel

I'd like to propose a change in the API, to allow restructuring of the match-making process, and avoid unexpected issues during its process.

The proposed API here is not final. I'd love to hear your thoughts about it!

Current behaviour

Currently, the match-making process may cause unexpected issues due to async rooms being disposed in the middle of the process, like #174

On the client-side, the room instance is immediately created even though the room might not be successfully created.

const room = client.join("my_room", { /* options */ });
room.onJoin.add(() => console.log("joined successfully!"))
room.onError.add(() => console.log("room couldn't be created?"))
  • This API can be confusing since both room creation errors, and regular room errors are dispatched into the same handler, without a differentiation between them.
  • It's not possible to determine whether a join error was caused by wrong credentials (onAuth) or a bug in the server.

Desired behaviour

The server can make extra-checks during the match-making process to avoid this error (#174), and provide better error handling in the client-side.

client.matchmake("my_room", {/* options */}, (err, room) => {
  if (err) { 
    console.log("match-making error: couldn't join into 'my_room'");
    console.log("reason:", err)
    return;
  }

  room.onJoin.add(() => console.log("joined successfully!"));
  room.onError.add(() => console.log("only room errors here"));
});

Version 1.0.0

As this is a big change in the API, I'm planning to have this on version 1.0.0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0