Debian Codegraph @

doc/requests.rst

raw
1 Requests
2 ========
3
4 Requests made via portal interfaces generally involve user interaction, and
5 dialogs that can stay open for a long time. Therefore portal APIs don't just use
6 async method calls (which time out after at most 25 seconds), but instead return
7 results via a ``Response`` signal on :ref:`Request <org.freedesktop.portal.Request>`
8 objects.
9
10 Portal APIs don't use properties very much. This is partially because we need to
11 be careful about the flow of information, and partially because it would be
12 unexpected to have a dialog appear when you just set a property. However, every
13 portal has at least one version property that specifies the maximum version
14 supported by xdg-desktop-portal.
15
16 General Flow
17 ------------
18
19 The general flow of the portal API is as follows:
20
21 1. The application makes a portal request
22 2. The portal replies to that method call with a handle (i.e. object path) to a
23 :ref:`Request <org.freedesktop.portal.Request>` object that corresponds to the
24 request
25 3. The object is exported on the bus and stays alive as long as the user
26 interaction lasts
27 4. When the user interaction is over, the portal sends a ``Response`` signal back
28 to the application with the results from the interaction, if any.
29
30 To avoid a race condition between the caller subscribing to the signal after
31 receiving the reply for the method call and the signal getting emitted, a
32 convention for Request object paths has been established that allows the caller
33 to subscribe to the signal before making the method call.