aboutsummaryrefslogtreecommitdiffstats
path: root/src/Client.hx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Client.hx')
-rw-r--r--src/Client.hx37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/Client.hx b/src/Client.hx
new file mode 100644
index 0000000..e44417a
--- /dev/null
+++ b/src/Client.hx
@@ -0,0 +1,37 @@
+package;
+
+#if nodejs
+import js.npm.ws.WebSocket;
+#elseif js
+import js.html.WebSocket;
+#end
+
+typedef ClientData = {
+ name:String,
+ isLeader:Bool
+}
+
+class Client {
+
+ public final ws:WebSocket;
+ public var name:String;
+ public var isLeader:Bool;
+
+ public function new(?ws:WebSocket, name:String, isLeader = false) {
+ this.ws = ws;
+ this.name = name;
+ this.isLeader = isLeader;
+ }
+
+ public function getData():ClientData {
+ return {
+ name: name,
+ isLeader: isLeader
+ }
+ }
+
+ public static function fromData(data:ClientData):Client {
+ return new Client(data.name, data.isLeader);
+ }
+
+}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage