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

Posts made by timo_u

RE: Remote functions

@ccfiel You could use messaging, i.e. on the client side use room.send() and then on the server side receive the message in the Room class' onMessage() handler. Depending on the message contents, execute required function and return reply to client with Room's send() method. Client will receive the reply via room's registered onMessage handler.

posted in Questions & Help • 13 Aug 2019, 14:06
Typescript error with

I am trying to compile the colyseus-examples project to javascript. For some reason I get this typescript compilation error from the colyseus package:

C:\projects\colyseus-examples>tsc --version
Version 3.5.3

C:\projects\colyseus-examples>npm run tsc

colyseus-examples@1.0.0 tsc C:\projects\colyseus-examples
tsc

node_modules/colyseus/lib/MatchMaker.d.ts:12:45 - error TS8020: JSDoc types can only be used inside documentation comments.

12 declare type RemoteRoomResponse<T = any> = [string?, T?];
~~~~~~~

node_modules/colyseus/lib/MatchMaker.d.ts:12:54 - error TS8020: JSDoc types can only be used inside documentation comments.

12 declare type RemoteRoomResponse<T = any> = [string?, T?];
~~

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! colyseus-examples@1.0.0 tsc: tsc
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the colyseus-examples@1.0.0 tsc script.

What could be the issue here?

To perform the compilation to javascript, I added tsc command to the colyseus-examples' package.json file under scripts:
"scripts": {
"tsc": "tsc",
"start": "nodemon --watch '*/.ts' --exec ts-node index.ts",
"heroku-postbuild": "npm run build"
},

posted in Questions & Help • 12 Aug 2019, 15:52
RE: Joining to specific room

Hi,

Will it do that if you leave the options out? I.e.:

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

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

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

posted in Questions & Help • 12 Aug 2019, 15:37

© 2023 Endel Dreyer