Browse Source

auto commit

master
jfinn 3 years ago
parent
commit
40f720bb0a
1 changed files with 18 additions and 0 deletions
  1. 18
    0
      wsps/consumers.py

+ 18
- 0
wsps/consumers.py View File

@@ -9,6 +9,24 @@ Mixins = wsps.tasks_loop.Mixins
9 9
 
10 10
 
11 11
 # class ChatConsumer(WebsocketConsumer,wsps.tasks_loop.AclTaskMixin,wsps.tasks_loop.AconMixin):
12
+class DispConsumer():
13
+    async def ws_rec_once(self, text_data):
14
+        # print("WS~~ 1")
15
+        msg_data = json.loads(text_data) 
16
+        # if 'message' in text_data_json:
17
+
18
+        if "key" in msg_data:
19
+            key = msg_data["key"]
20
+            mthd = getattr(self,key,None)
21
+            if mthd:
22
+                await mthd(msg_data) 
23
+            else:
24
+                p("METHOD " + key + " NOT FOUND!")
25
+        print("",end="",flush=True)
26
+
27
+
28
+
29
+
12 30
 class ChatConsumer(
13 31
     Mixins.DevMixin,
14 32
     Mixins.LoneMixinA,

Loading…
Cancel
Save