question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Colyseus 0.14 ref id not found

See original GitHub issue

Hello

1

Sending a Schema object to client which is part of the room state causes this error but it’s not happening when sending a new object:

Example:

This causes error:

onCreate (options: any) {
  var state = new MyRoomState()
  state.player = new Player()
  this.setState(state);

  this.clock.setTimeout(() => {
    this.broadcast(state.player)
  }, 3000)
}

This doesn’t:

onCreate (options: any) {
  var state = new MyRoomState()
  state.player = new Player()
  this.setState(state);

  this.clock.setTimeout(() => {
    this.broadcast(new Player())
  }, 3000)
}

Steps to reproduce:

  1. Run this: https://github.com/doorbash/colyseus-ref-id-not-found
  2. Connect with any client and wait 3s

2

This one is reported to me by @vinsmain via email and I ran it with js client and fortunately it happened there too!

Steps to reproduce:

  1. Run this: https://github.com/doorbash/colyseus-ref-id-not-found2
  2. Connect to it like this:
import { Client } from ".";

const client = new Client("ws://localhost:2567");

(async () => {
    try {
        const room = await client.joinOrCreate<any>("game");

        room.state.selectedInvestigators.onAdd = ((value, key) => {
            console.log("ADD INV " + key + " " + value.influence);

            if (key == 0) room.send("inv", "null");
        });

        room.send("addCard")

    } catch (e) {
        console.error("couldn't join room:", e);
    }
})()

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
endelcommented, Oct 20, 2020

Thanks a lot for reporting @doorbash ❤️ I’m in the process of releasing Colyseus 0.14 fixing this right now! 🎉

1reaction
endelcommented, Oct 22, 2020

Hey @vinsmain, just published @colyseus/schema@1.0.1 fixing this! Let me know if you face any other issues!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting / Issues - Colyseus & Arena Cloud ...
The following are the most commonly reported issues when deploying an application to Colyseus Arena. prelaunch-actions.sh - not found or bad variable name¶....
Read more >
The Client Instance - Colyseus docs
Joins an existing room by its roomId . Private rooms can be joined by id. ... See getAvailableRooms() to retrieve a list of...
Read more >
0.14 - Colyseus & Arena Cloud Documentation
Documentation for Colyseus Multiplayer Framework for Node.js.
Read more >
Room - Colyseus & Arena Cloud Documentation
broadcast (type, message, options?) ¶. Send a message to all connected clients. Available options are: except : a Client instance not to ...
Read more >
Schema - Colyseus & Arena Cloud Documentation
array.indexOf() ¶. Returns the first index at which a given element can be found in the array, or -1 if it is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found