Navigation

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

    T0RAT0RA

    @T0RAT0RA

    Chat Follow Unfollow
    1
    Reputation
    1
    Posts
    870
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

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

    Posts made by T0RAT0RA

    RE: Version 0.9.0 has been released!

    Hi,

    thanks for the release, this is awesome!

    I have an issue though, I'm getting error (RESOLED, see below) : colyseus.js: server error: Class constructor Room cannot be invoked without 'new'

    Client-side:

    client = new Colyseus.Client('ws://localhost:9090');
    room = client.join('basic');
    

    Server-side:

    #index.js
    const colyseus = require("colyseus");
    const http = require("http");
    const express = require("express");
    
    const app = express();
    const gameServer = new colyseus.Server({
      server: http.createServer(app)
    });
    
    class BasicRoom extends colyseus.Room {
        requestJoin (options, isNew) {
            console.log('Quizzroom requestJoin: ', options, isNew);
            return true;
        }
    
        onJoin (client) {
            console.log(`BasicRoom - client ${client.sessionId} joined.`);
        }
    
    }
    
    gameServer.register("basic", BasicRoom);
    gameServer.listen(9090);
    
    

    The documentation doesn't provide example in javascript, only typescript.
    Is there something I'm missing?

    UPDATE:
    I was running the server with nodemon server.js --exec babel-node and I should use nodemon server.js.
    Everything is fine now.

    posted in Announcements •