Navigation

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

    ccfiel

    @ccfiel

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

    • 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 •
    Remote functions

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

    posted in Questions & Help •