adding initial testing consumers/routes for channels

This commit is contained in:
Wayne Witzel III
2016-08-08 12:53:04 -04:00
parent c4c1429989
commit 62beb24d62
2 changed files with 19 additions and 0 deletions

13
awx/main/consumers.py Normal file
View File

@@ -0,0 +1,13 @@
from channels import Group
from channels.sessions import channel_session
@channel_session
def job_event_connect(message):
job_id = message.content['path'].strip('/')
message.channel_session['job_id'] = job_id
Group("job_events-%s" % job_id).add(message.reply_channel)
def emit_channel_notification(event, payload):
Group(event).send(payload)