mirror of
https://github.com/django/daphne.git
synced 2025-07-11 00:12:18 +03:00
Change content dict in code snippets to correct format
This commit is contained in:
parent
f85c992cda
commit
adb8685f33
|
@ -185,8 +185,10 @@ set of channels (here, using Redis) to send updates to::
|
||||||
# Loop through all response channels and send the update
|
# Loop through all response channels and send the update
|
||||||
for reply_channel in redis_conn.smembers("readers"):
|
for reply_channel in redis_conn.smembers("readers"):
|
||||||
Channel(reply_channel).send({
|
Channel(reply_channel).send({
|
||||||
"id": instance.id,
|
"text": json.dumps({
|
||||||
"content": instance.content,
|
"id": instance.id,
|
||||||
|
"content": instance.content
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
# Connected to websocket.connect
|
# Connected to websocket.connect
|
||||||
|
@ -223,8 +225,10 @@ abstraction as a core concept called Groups::
|
||||||
@receiver(post_save, sender=BlogUpdate)
|
@receiver(post_save, sender=BlogUpdate)
|
||||||
def send_update(sender, instance, **kwargs):
|
def send_update(sender, instance, **kwargs):
|
||||||
Group("liveblog").send({
|
Group("liveblog").send({
|
||||||
"id": instance.id,
|
"text": json.dumps({
|
||||||
"content": instance.content,
|
"id": instance.id,
|
||||||
|
"content": instance.content
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
# Connected to websocket.connect
|
# Connected to websocket.connect
|
||||||
|
|
Loading…
Reference in New Issue
Block a user