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. ccfiel
ccfiel

ccfiel

@ccfiel

Chat Follow Unfollow
0
Reputation
2
Posts
951
Profile views
0
Followers
0
Following
Joined 20 Jul 2019, 06:36 Last Online 11 Aug 2019, 06:27

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

Posts made by ccfiel

Joining to specific room

Re: New Room (SOLVED)

SERVER SIDE

export class Table extends Room {
  onInit (options: any) {
  }

  requestJoin (options: any, isNew: boolean) {
    return (options.create)
        ? (options.create && isNew)
        : this.clients.length > 0;
  }

  onJoin (client: Client, options: any) {}
  onMessage (client: Client, message: any) {}
  onLeave (client: Client, consented: boolean) {}
  onDispose() {}
}

CLIENT SIDE

import * as Colyseus from "colyseus.js";
let client = new Colyseus.Client("ws://localhost:2567");

let room1 = client.join("table", {create: true});
room1.onJoin.add(() => {
    console.log(client.id, "created", room1.name, " ", room1.id);
});

let room2 = client.join("table", {create: true});
room2.onJoin.add(() => {
    console.log(client.id, "created", room2.name, " ", room2.id);
});

This will create 2 different rooms. How can I specify e client to join to e specific room?

posted in Questions & Help • 23 Jul 2019, 04:25
Remote functions

Is there a way to create a server side function that can be called in the client side?

posted in Questions & Help • 21 Jul 2019, 06:45

© 2023 Endel Dreyer