TypeError when "requestJoin" turns false
See original GitHub issueUsing 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:
- Created 6 years ago
- Comments:10 (10 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@endel Could you DM me your email via Twitter?
Thanks @oyed @Federkun
Last version is
0.5.4
with this fix.