mirror of
https://github.com/ansible/awx.git
synced 2026-07-03 04:18:02 -02:30
add websocket health information
This commit is contained in:
committed by
Ryan Petrello
parent
ea29f4b91f
commit
403e9bbfb5
@@ -122,6 +122,29 @@ class BroadcastConsumer(AsyncJsonWebsocketConsumer):
|
||||
await self.send(event['text'])
|
||||
|
||||
|
||||
class HealthConsumer(AsyncJsonWebsocketConsumer):
|
||||
async def connect(self):
|
||||
try:
|
||||
WebsocketSecretAuthHelper.is_authorized(self.scope)
|
||||
except Exception:
|
||||
await self.close()
|
||||
return
|
||||
|
||||
# TODO: log ip of connected client
|
||||
logger.info("Client connected to health endpoint")
|
||||
await self.accept()
|
||||
|
||||
async def disconnect(self, code):
|
||||
# TODO: log ip of disconnected client
|
||||
logger.info("Client disconnected from health endpoint")
|
||||
|
||||
async def receive_json(self, content, **kwargs):
|
||||
logger.debug(f"Got Health status {content}")
|
||||
|
||||
async def internal_message(self, event):
|
||||
logger.info("Got internal message from health endpoint .. can this happen?")
|
||||
|
||||
|
||||
class EventConsumer(AsyncJsonWebsocketConsumer):
|
||||
async def connect(self):
|
||||
user = self.scope['user']
|
||||
|
||||
Reference in New Issue
Block a user