8 *#include <nghttp2/nghttp2.h>*
10 .. function:: int nghttp2_session_send(nghttp2_session *session)
13 Sends pending frames to the remote peer.
15 This function retrieves the highest prioritized frame from the
16 outbound queue and sends it to the remote peer. It does this as
17 many as possible until the user callback
18 :type:`nghttp2_send_callback` returns
19 :macro:`NGHTTP2_ERR_WOULDBLOCK` or the outbound queue becomes empty.
20 This function calls several callback functions which are passed
21 when initializing the *session*. Here is the simple time chart
22 which tells when each callback is invoked:
24 1. Get the next frame to send from outbound queue.
26 2. Prepare transmission of the frame.
28 3. If the control frame cannot be sent because some preconditions
29 are not met (e.g., request HEADERS cannot be sent after GOAWAY),
30 :type:`nghttp2_on_frame_not_send_callback` is invoked. Abort
33 4. If the frame is HEADERS, PUSH_PROMISE or DATA,
34 :type:`nghttp2_select_padding_callback` is invoked.
36 5. If the frame is request HEADERS, the stream is opened here.
38 6. :type:`nghttp2_before_frame_send_callback` is invoked.
40 7. If :macro:`NGHTTP2_ERR_CANCEL` is returned from
41 :type:`nghttp2_before_frame_send_callback`, the current frame
42 transmission is canceled, and
43 :type:`nghttp2_on_frame_not_send_callback` is invoked. Abort
46 8. :type:`nghttp2_send_callback` is invoked one or more times to
49 9. :type:`nghttp2_on_frame_send_callback` is invoked.
51 10. If the transmission of the frame triggers closure of the
52 stream, the stream is closed and
53 :type:`nghttp2_on_stream_close_callback` is invoked.
55 This function returns 0 if it succeeds, or one of the following
58 :macro:`NGHTTP2_ERR_NOMEM`
60 :macro:`NGHTTP2_ERR_CALLBACK_FAILURE`
61 The callback function failed.