Commit 94671fed by Chif Gergő

Receive message

parent fbc6f0f5
Pipeline #1091 failed with stage
in 1 minute 45 seconds
......@@ -16,7 +16,7 @@ class StatusConsumer(WebsocketConsumer):
# If login message arrives get the auth token from it
# Then subscribe to the channels of the vm's that belongs to the user
def login(self, event):
def login(self, auth_token):
user_token = event["auth_token"]
token = Token.objects.get(key=user_token)
if token:
......@@ -40,8 +40,11 @@ class StatusConsumer(WebsocketConsumer):
self.channel_name
)
def receive(self, text_message):
pass
def receive(self, text_data):
text_data_json = json.loads(text_data)
type = text_data_json['type']
if type == 'login':
self.login(text_data_json['auth_token'])
def status_changed(self, event):
self.send(text_data=json.dumps({"vm": event["vm"], "status": event["status"]}))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment