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. T0RAT0RA
  3. Posts
  • Profile
  • More
    • Continue chat with T0RAT0RA
    • Flag Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

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 • 31 Mar 2018, 01:37

© 2023 Endel Dreyer