This commit is contained in:
xuyue committed 2025-07-16 01:02:12 +08:00
1 parent 01e5c9097c
commit 108a125810
13 files changed
+554 -7

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
import json
from channels.generic.websocket import WebsocketConsumer
class ChatConsumer(WebsocketConsumer):
def connect(self):
self.accept()
def disconnect(self, close_code):
pass
def receive(self, text_data):
text_data_json = json.loads(text_data)
message = text_data_json["message"]
self.send(text_data=json.dumps({"message": message}))