]> git.cworth.org Git - lmno-server/blobdiff - game.js
Add a new "broadcast_event_object" method to accept an obejct not a string
[lmno-server] / game.js
diff --git a/game.js b/game.js
index eb78f31ecbe531a38801cbbb9b4a466eb968d8cc..eb1ba807c3e1d9ec5a0e9eda65fceafaff052338 100644 (file)
--- a/game.js
+++ b/game.js
@@ -224,6 +224,10 @@ class Game {
     this.broadcast_string(`event: ${type}\ndata: ${data}\n`);
   }
 
+  broadcast_event_object(type, obj) {
+    this.broadcast_event(type, JSON.stringify(obj));
+  }
+
   handle_events(request, response) {
     /* These headers will keep the connection open so we can stream events. */
     const headers = {