Skip to content

Commit

Permalink
Send initial operation status
Browse files Browse the repository at this point in the history
See also: #17
  • Loading branch information
BECATRUE committed Dec 3, 2024
1 parent 8f2ca21 commit 0a94aca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions wlm_server/operation/consumers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import json

from channels.generic.websocket import AsyncWebsocketConsumer

from utils import util

class OperationConsumer(AsyncWebsocketConsumer):
"""Consumer for notifying the operation change of a specific channel.
Expand All @@ -14,6 +18,7 @@ async def connect(self):
self.group_name = f'channel_{self.ch}_operation'
await self.channel_layer.group_add(self.group_name, self.channel_name)
await self.accept()
await self.send(text_data=json.dumps({'on': util.is_channel_running(self.ch)}))

async def disconnect(self, code):
await self.channel_layer.group_discard(self.group_name, self.channel_name)
Expand Down

0 comments on commit 0a94aca

Please sign in to comment.