summaryrefslogtreecommitdiff
path: root/scripts/socket/message.js
diff options
context:
space:
mode:
authorKyle Gunger <corechg@gmail.com>2020-09-18 12:19:44 -0400
committerKyle Gunger <corechg@gmail.com>2020-09-18 12:19:44 -0400
commitdbaf69557c0d6e648120b068fec1920b9391a24a (patch)
treef31f7b956455b1243d344d0c54d5b04e9e80fb3f /scripts/socket/message.js
parente5515d3e1603339b4957421c9494ca619490a03d (diff)
Update from local repo
Diffstat (limited to 'scripts/socket/message.js')
-rw-r--r--scripts/socket/message.js18
1 files changed, 18 insertions, 0 deletions
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});
+ }
+}