aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun_event.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-07-24 16:22:26 +0200
committerLoïc Hoguin <[email protected]>2019-07-24 16:22:26 +0200
commit3d1e3c9e6e779bca839b86717adb2487b4a1c2c6 (patch)
tree488db6e9ea303d8866eb2affc706d2162a9deb70 /src/gun_event.erl
parent8c6adf73d9d3fa1ebb49d4b9bd71caab1815dcb2 (diff)
downloadgun-3d1e3c9e6e779bca839b86717adb2487b4a1c2c6.tar.gz
gun-3d1e3c9e6e779bca839b86717adb2487b4a1c2c6.tar.bz2
gun-3d1e3c9e6e779bca839b86717adb2487b4a1c2c6.zip
Add the cancel event for local/remote stream cancellation
Diffstat (limited to 'src/gun_event.erl')
-rw-r--r--src/gun_event.erl21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/gun_event.erl b/src/gun_event.erl
index f27d336..c87af58 100644
--- a/src/gun_event.erl
+++ b/src/gun_event.erl
@@ -236,6 +236,25 @@
-callback ws_send_frame_start(ws_send_frame_event(), State) -> State.
-callback ws_send_frame_end(ws_send_frame_event(), State) -> State.
+%% cancel.
+%%
+%% In the case of HTTP/1.1 we cannot actually cancel the stream,
+%% we only silence the stream to the user. Further response events
+%% may therefore be received and they provide a useful metric as
+%% these canceled requests monopolize the connection.
+%%
+%% For HTTP/2 both the client and the server may cancel streams.
+%% Events may still occur for a short time after the cancel.
+
+-type cancel_event() :: #{
+ stream_ref := reference(),
+ reply_to := pid(),
+ endpoint := local | remote,
+ reason := atom()
+}.
+
+-callback cancel(cancel_event(), State) -> State.
+
%% disconnect.
-type disconnect_event() :: #{
@@ -255,5 +274,3 @@
%% @todo origin_changed
%% @todo transport_changed
-%% @todo cancel_start
-%% @todo cancel_end