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 = {
}
broadcast_move(move) {
- this.broadcast_event("move", move);
+ this.broadcast_event("move", JSON.stringify(move));
}
}