Skip to content

Commit

Permalink
Update demo-webrtc-group-game.js
Browse files Browse the repository at this point in the history
  • Loading branch information
cacheflowe committed Jan 29, 2024
1 parent 884a956 commit 3174e62
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions demo/demo-webrtc-group-game.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ class WebRtcGroupGameDemo extends DemoBase {
this.closeButton = this.el.querySelector("#close-connections");
this.closeButton.addEventListener("click", () => {
this.kiosk.closeAllConnections();
this.qrId = new ShortUniqueId()(); // append handshake ID to querystring - uses ShortUniqueId module
this.kiosk.buildQrCode(`&qrId=${this.qrId}`);
this.newQrSession();
});
// start game button
this.startButton = this.el.querySelector("#game-start");
Expand Down Expand Up @@ -73,6 +72,11 @@ class WebRtcGroupGameDemo extends DemoBase {
return this.userColors[this.colorIndex];
}

newQrSession() {
this.qrId = new ShortUniqueId()(); // append handshake ID to querystring - uses ShortUniqueId module
this.kiosk.buildQrCode(`&qrId=${this.qrId}`);
}

buildKiosk() {
// Kiosk features:
// - Advertise the kiosk connection via QR code & allow multiple connections
Expand All @@ -95,8 +99,7 @@ class WebRtcGroupGameDemo extends DemoBase {
_notyfSuccess("serverConnected!");
setTimeout(() => {
// kick off QR code generation with qrId for single-session authentication handshake
this.qrId = new ShortUniqueId()();
this.kiosk.buildQrCode(`&qrId=${this.qrId}`);
this.newQrSession();
}, 200);
});
this.kiosk.addListener("serverDisconnected", (data) => {
Expand Down

0 comments on commit 3174e62

Please sign in to comment.