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.

TypeError when "requestJoin" turns false

See original GitHub issue

Using the colyseus-examples, with those changes:

import { Room } from "colyseus";

export class ChatRoom extends Room {

    onInit (options) {
        this.setState({ messages: [] });
        console.log("ChatRoom created!", options);
    }

+    requestJoin(options) {
+       const canJoin = this.clients.length < 2;
+      console.log('can join', canJoin, this.clients.length );
+      return canJoin;
+    }

    onJoin (client) {
        this.state.messages.push(`${ client.id } joined.`);
    }

    onLeave (client) {
        this.state.messages.push(`${ client.id } left.`);
    }

    onMessage (client, data) {
        this.state.messages.push(data.message);
        console.log("ChatRoom:", client.id, data);
    }

    onDispose () {
        console.log("Dispose ChatRoom");
    }

}

I get:

ChatRoom created! {}
can join true 0
can join true 1
process 6992 is responding to REQUEST_JOIN_ROOM
can join true 1
can join false 2
process 6992 is responding to REQUEST_JOIN_ROOM
/src/colyseus-examples/node_modules/colyseus/lib/cluster/Worker.js:100
                process.send([matchMakingPid, joinOptions.clientId, process.pid, room_1.roomId$ score_1]);
                                                                                       ^

TypeError: Cannot read property 'roomId' of undefined
    at /src/colyseus-examples/node_modules/colyseus/lib/cluster/Worker.js:100:88
    at Object.6992:6 (/src/colyseus-examples/node_modules/colyseus/lib/cluster/Worker.js:124:9$
    at Store.consume (/src/colyseus-examples/node_modules/memshared/lib/Store.js:25:47)
    at process.workerHandleIncomingMessage (/src/colyseus-examples/node_modules/memshared/lib/$ndex.js:31:19)
    at emitTwo (events.js:130:20)
    at process.emit (events.js:213:7)
    at handleMessage (internal/child_process.js:753:14)
    at Pipe.channel.onread (internal/child_process.js:472:11)
worker 6986 died. Respawn.
/src/colyseus-examples/node_modules/colyseus/lib/ClusterServer.js:47
                worker.send([Protocol_1.Protocol.PASS_WEBSOCKET, {
                      ^

What should be the expected behavior?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
oyedcommented, Sep 5, 2017

@endel Could you DM me your email via Twitter?

1reaction
endelcommented, Aug 31, 2017

Thanks @oyed @Federkun

Last version is 0.5.4 with this fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError when "requestJoin" turns false · Issue #82 - GitHub
Using the colyseus-examples, with those changes: import { Room } from "colyseus"; export class ChatRoom extends Room { onInit (options) ...
Read more >
Brookstone rover 2.0 Python program to control from computer ...
I know almost nothing about python by the way. I'm using windows 10 64 bit. python · python-2.7 · python-3.x · opencv ·...
Read more >
vuejs/vue - Gitter
I have a table. each <tr> is a component. I want this component to have a detail row... Meaning: The component should have...
Read more >
Use a Custom Script - Splunk Documentation
... line request = ' '.join(request.split()) url = request.split()[1] if url: host = headers.get('Host') if url.startswith('http') is False: ...
Read more >
Alliance Auth Documentation - Read the Docs
access_token – Discord access token used to authenticate all calls to the API. • redis – Redis instance to be used. • is_rate_limited...
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