Last active
December 18, 2018 21:49
-
-
Save endel/1c8b0c3ffeb7b15b658d52136e74305a to your computer and use it in GitHub Desktop.
Using custom-generated `roomId` on Colyseus https://discuss.colyseus.io/topic/181/how-to-generate-unique-6-digit-game-code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// npm install nanoid | |
import * as generateId from "nanoid/generate"; | |
class MyRoomHandler extends Room { | |
onInit () { | |
// this may introduce colliding `roomId`, use at your own risk | |
this.roomId = generateId("1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ", 6); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment