@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.
Posts made by timo_u
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"
},
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);
});