X-Git-Url: https://git.r.bdr.sh/rbdr/sorting-hat/blobdiff_plain/4d2c4ed3151e72ea2aabd9d27b447ea4cbd5724d..HEAD:/lib/sorting_hat.js?ds=sidebyside diff --git a/lib/sorting_hat.js b/lib/sorting_hat.js index 6ab1a09..ac78f3d 100644 --- a/lib/sorting_hat.js +++ b/lib/sorting_hat.js @@ -31,7 +31,7 @@ const internals = { tmnt: { leonardo: ['hiAlpha', 'loBeta', 'loGamma'], donatello: ['loAlpha', 'hiAlpha', 'midGamma'], - michaelangelo: ['delta', 'theta', 'loAlpha'], + michaelangelo: ['loAlpha', 'hiBeta', 'midGamma'], raphael: ['loBeta', 'hiBeta', 'loGamma'] } } @@ -96,7 +96,7 @@ module.exports = class SortingHat { this._mindWave = null; // Our main device this._socketServer = null; // Our socket server used to communicate with frontend this._timer = null; // An internal timer for time based states - this._winner = null // The current winner + this._winner = null; // The current winner } /** @@ -135,6 +135,8 @@ module.exports = class SortingHat { if (this._mindWave) { this._stopListening(); + this._socketServer.close(); + this._socketServer = null; this._mindWave = null; } else { @@ -351,7 +353,7 @@ module.exports = class SortingHat { for (const client of this._socketServer.clients) { if (client.readyState === WebSocket.OPEN) { - client.send(state); + client.send(JSON.stringify(state)); } } }