mirror of
https://github.com/django/daphne.git
synced 2025-07-14 18:02:17 +03:00
fields update for binding
This commit is contained in:
parent
8c6050fbba
commit
174430c817
|
@ -65,6 +65,7 @@ get started and likely close to what you want. Start off like this::
|
||||||
|
|
||||||
model = IntegerValue
|
model = IntegerValue
|
||||||
stream = "intval"
|
stream = "intval"
|
||||||
|
fields = ["name", "value"]
|
||||||
|
|
||||||
def group_names(self, instance, action):
|
def group_names(self, instance, action):
|
||||||
return ["intval-updates"]
|
return ["intval-updates"]
|
||||||
|
@ -73,9 +74,13 @@ get started and likely close to what you want. Start off like this::
|
||||||
return True
|
return True
|
||||||
|
|
||||||
This defines a WebSocket binding - so it knows to send outgoing messages
|
This defines a WebSocket binding - so it knows to send outgoing messages
|
||||||
formatted as JSON WebSocket frames - and provides the two methods you must
|
formatted as JSON WebSocket frames - and provides the three things you must
|
||||||
always provide:
|
always provide:
|
||||||
|
|
||||||
|
* ``fields`` is a whitelist of fields to return in the serialized request.
|
||||||
|
Channels does not default to all fields for security concerns; if you want
|
||||||
|
this, set it to the value ``["__all__"]``.
|
||||||
|
|
||||||
* ``group_names`` returns a list of groups to send outbound updates to based
|
* ``group_names`` returns a list of groups to send outbound updates to based
|
||||||
on the model and action. For example, you could dispatch posts on different
|
on the model and action. For example, you could dispatch posts on different
|
||||||
liveblogs to groups that included the parent blog ID in the name; here, we
|
liveblogs to groups that included the parent blog ID in the name; here, we
|
||||||
|
|
Loading…
Reference in New Issue
Block a user