mirror of
https://github.com/django/daphne.git
synced 2025-07-01 18:33:06 +03:00
A few more docs on polls
This commit is contained in:
parent
4d580c2575
commit
0954829248
|
@ -147,3 +147,15 @@ from the base ``Binding`` class and implement serialization and deserialization
|
||||||
yourself. Until proper reference documentation for this is written, we
|
yourself. Until proper reference documentation for this is written, we
|
||||||
recommend looking at the source code in ``channels/bindings/base.py``; it's
|
recommend looking at the source code in ``channels/bindings/base.py``; it's
|
||||||
reasonably well-commented.
|
reasonably well-commented.
|
||||||
|
|
||||||
|
|
||||||
|
Dealing with Disconnection
|
||||||
|
--------------------------
|
||||||
|
|
||||||
|
Because the data binding Channels ships with has no history of events,
|
||||||
|
it means that when a disconnection happens you may miss events that happen
|
||||||
|
during your offline time. For this reason, it's recommended you reload
|
||||||
|
data directly using an API call once connection has been re-established,
|
||||||
|
don't rely on the live updates for critical functionality, or have UI designs
|
||||||
|
that cope well with missing data (e.g. ones where it's all updates and no
|
||||||
|
creates, so the next update will correct everything).
|
||||||
|
|
|
@ -154,3 +154,19 @@ Are channels Python 2, 3 or 2+3?
|
||||||
Django-channels and all of its dependencies are compatible with Python 2.7,
|
Django-channels and all of its dependencies are compatible with Python 2.7,
|
||||||
3.3, and higher. This includes the parts of Twisted that some of the Channels
|
3.3, and higher. This includes the parts of Twisted that some of the Channels
|
||||||
packages (like daphne) use.
|
packages (like daphne) use.
|
||||||
|
|
||||||
|
|
||||||
|
Why isn't there support for socket.io/SockJS/long poll fallback?
|
||||||
|
----------------------------------------------------------------
|
||||||
|
|
||||||
|
Emulating WebSocket over HTTP long polling requires considerably more effort
|
||||||
|
than terminating WebSockets; some server-side state of the connection must
|
||||||
|
be kept in a place that's accessible from all nodes, so when the new long
|
||||||
|
poll comes in, messages can be replayed onto it.
|
||||||
|
|
||||||
|
For this reason, we think it's out of scope for Channels itself, though
|
||||||
|
Channels and Daphne come with first-class support for long-running HTTP
|
||||||
|
connections without taking up a worker thread (you can consume ``http.request``
|
||||||
|
and not send a response until later, add the reply channel to groups,
|
||||||
|
and even listen out for the ``http.disconnect`` channel that tells you when
|
||||||
|
long polls terminate early).
|
||||||
|
|
Loading…
Reference in New Issue
Block a user