Skip to content

Commit 62901e5

Browse files
committed
Add draft
1 parent b44814c commit 62901e5

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

doc/dev_guide/internals/box_protocol.rst

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1610,6 +1610,41 @@ In other words, there should be a full-mesh connection between the nodes.
16101610
16111611
})
16121612
1613+
.. _box-protocol-watchers:
1614+
1615+
Watchers
1616+
--------
1617+
1618+
The commands below support asynchronous server-client
1619+
notifications signaled with ``box.broadcast()``.
1620+
Servers that support the new feature set the ``IPROTO_FEATURE_WATCHERS``
1621+
feature bit (bit 3) in reply to the ``IPROTO_ID`` command.
1622+
When a connection is closed, all watchers registered for it are unregistered.
1623+
1624+
IPROTO_WATCH (code 74)
1625+
~~~~~~~~~~~~~~~~~~~~~~
1626+
1627+
Registers a new watcher for the given notification key or acknowledges a notification if a watcher is
1628+
already subscribed.
1629+
The key name is passed in ``IPROTO_EVENT_KEY`` (code 0x56).
1630+
The watcher will be notified unconditionally after registration and then every time the key is updated with
1631+
``box.broadcast()`` provided the last notification was acknowledged.
1632+
The server doesn't reply to the request unless it fails to parse the packet.
1633+
1634+
IPROTO_UNWATCH (code 75)
1635+
~~~~~~~~~~~~~~~~~~~~~~~~
1636+
1637+
Unregisters a watcher subscribed for the given notification key.
1638+
The key name is passed in ``IPROTO_EVENT_KEY`` (code 0x56).
1639+
A server doesn't reply to the request unless it fails to parse the packet.
1640+
1641+
IPROTO_EVENT (code 76)
1642+
~~~~~~~~~~~~~~~~~~~~~~
1643+
1644+
Sent by the server to notify a client about a key update.
1645+
The key name is passed in ``IPROTO_EVENT_KEY`` (code 0x56).
1646+
The key data (optional) is passed in ``IPROTO_EVENT_DATA`` (code 0x57).
1647+
16131648
.. _box_protocol-illustration:
16141649

16151650
Examples

0 commit comments

Comments
 (0)