From dbaf69557c0d6e648120b068fec1920b9391a24a Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Fri, 18 Sep 2020 12:19:44 -0400 Subject: Update from local repo --- scripts/socket/message.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 scripts/socket/message.js (limited to 'scripts/socket/message.js') diff --git a/scripts/socket/message.js b/scripts/socket/message.js new file mode 100644 index 0000000..044027d --- /dev/null +++ b/scripts/socket/message.js @@ -0,0 +1,18 @@ +'use strict'; + +class Message{ + constructor (type, data) + { + this.t = type; + this.d = data; + } + + stringify () + { + var dat = this.d + if(typeof dat !== "string"){ + dat = JSON.stringify(dat); + } + return JSON.stringify({type: this.t, data: dat}); + } +} -- cgit v1.2.3