Skip to content

Instantly share code, notes, and snippets.

@endel
Last active March 1, 2021 13:55
Show Gist options
  • Save endel/ed1914c0d06df4d2b5b616f586f71188 to your computer and use it in GitHub Desktop.
Save endel/ed1914c0d06df4d2b5b616f586f71188 to your computer and use it in GitHub Desktop.
Colyseus: using the same room handler for multiple rooms.
var Room = require('colyseus').Room
class ChatRoom extends Room {
constructor (options) {
super( options )
this.name = options.name;
this.setState({ messages: [] })
}
requestJoin(options) {
return this.name === options.name;
}
}
client.join("chat_room", { name: "global" });
client.join("chat_room", { name: "specific" });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment