Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
RECIRCLE
/
portal
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
11
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
94671fed
authored
Apr 27, 2020
by
Chif Gergő
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Receive message
parent
fbc6f0f5
Pipeline
#1091
failed with stage
in 1 minute 45 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
recircle/status/consumers.py
+6
-3
No files found.
recircle/status/consumers.py
View file @
94671fed
...
...
@@ -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"
]}))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment