# nghq # # Copyright (c) 2018 nghq contributors # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @startuml participant Application as app #87CEEB participant nghq #99FF99 app->app: Open new UDP socket == Send Client Handshake == app->nghq: nghq_session_client_new() activate nghq nghq-->app: nghq_encrypt_callback nghq-->app: nghq_send_callback == Receive Server Handshake == nghq-->app: nghq_recv_callback nghq-->app: nghq_decrypt_callback == Connection Established == group Make Request app->nghq: nghq_feed_headers() note right: Set final flag non-zero to\nindicate no body data in\nrequest. app->nghq: nghq_session_send() nghq-->app: nghq_encrypt_callback nghq-->app: nghq_send_callback opt Send request body data loop app->nghq: nghq_feed_payload_data() note right: Set final flag non-zero to end app->nghq: nghq_session_send() nghq-->app: nghq_encrypt_callback nghq-->app: nghq_send_callback end loop end opt app->app: Wait for socket to have data app->nghq: nghq_session_recv() nghq-->app: nghq_recv_callback nghq-->app: nghq_decrypt_callback nghq-->app: nghq_on_begin_headers_callback loop foreach header nghq-->app: nghq_on_headers_callback end loop loop Receive response body data app->app: Wait for socket to have data app->nghq: nghq_session_recv() nghq-->app: nghq_recv_callback nghq-->app: nghq_decrypt_callback alt Body data received nghq-->app: nghq_on_data_recv_callback else Push promise received nghq-->app: nghq_on_begin_headers_callback note right: Type indicates\nPush Promise loop foreach request header nghq-->app: nghq_on_headers_callback end loop end alt end loop nghq-->app: nghq_on_request_close_callback end group group Receive Server Push app->app: Socket has data to read app->nghq: nghq_session_recv() nghq-->app: nghq_recv_callback nghq-->app: nghq_decrypt_callback loop foreach header nghq-->app: nghq_on_headers_callback end loop loop Receive pushed body data app->app: Wait for socket to have data app->nghq: nghq_session_recv() nghq-->app: nghq_recv_callback nghq-->app: nghq_decrypt_callback nghq-->app: nghq_on_data_recv_callback end loop nghq-->app: nghq_on_request_close_callback end group app->nghq: nghq_session_close() loop Closing nghq-->app: nghq_encrypt_callback() nghq-->app: nghq_send_callback() end loop deactivate nghq app->nghq: nghq_session_free() @enduml