Files
Hulumath-Web/backend/common/consumers.py
Jacky 1f98f7152d
CI / test (push) Failing after 1m31s
v0.2 Preview: Construction Plan.
2026-08-08 21:25:27 +08:00

18 lines
573 B
Python

from channels.generic.websocket import AsyncJsonWebsocketConsumer
class HealthConsumer(AsyncJsonWebsocketConsumer):
group_name = "healthcheck"
async def connect(self):
try:
await self.channel_layer.group_add(self.group_name, self.channel_name)
await self.channel_layer.group_discard(self.group_name, self.channel_name)
except Exception:
await self.close(code=1011)
return
await self.accept()
await self.send_json({"status": "ok", "channel_layer": "ok"})
await self.close()