aboutsummaryrefslogtreecommitdiffstats
path: root/src/gun.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-04-26 20:30:51 +0200
committerLoïc Hoguin <[email protected]>2019-04-26 20:30:51 +0200
commitcee8c6625bd7a09db88daf5e9767cced66fb5c15 (patch)
tree7948616a11e1025c10e60c60f563b6d331d88ee8 /src/gun.erl
parent352206dee80905b10fa9af97f065ce7bee928d87 (diff)
downloadgun-cee8c6625bd7a09db88daf5e9767cced66fb5c15.tar.gz
gun-cee8c6625bd7a09db88daf5e9767cced66fb5c15.tar.bz2
gun-cee8c6625bd7a09db88daf5e9767cced66fb5c15.zip
Add upgrade/ws tuples to gun:await/2,3,4
Diffstat (limited to 'src/gun.erl')
-rw-r--r--src/gun.erl7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gun.erl b/src/gun.erl
index b1f493b..7376a33 100644
--- a/src/gun.erl
+++ b/src/gun.erl
@@ -494,6 +494,8 @@ connect(ServerPid, Destination, Headers, ReqOpts) ->
| {data, fin | nofin, binary()}
| {trailers, resp_headers()}
| {push, reference(), binary(), binary(), resp_headers()}
+ | {upgrade, [binary()], resp_headers()}
+ | {ws, ws_frame()} %% @todo Excluding ping/pong, for now.
| {error, {stream_error | connection_error | down, any()} | timeout}.
-spec await(pid(), reference()) -> await_result().
@@ -512,7 +514,6 @@ await(ServerPid, StreamRef, Timeout) ->
demonitor(MRef, [flush]),
Res.
-%% @todo Add gun_upgrade and gun_ws?
-spec await(pid(), reference(), timeout(), reference()) -> await_result().
await(ServerPid, StreamRef, Timeout, MRef) ->
receive
@@ -526,6 +527,10 @@ await(ServerPid, StreamRef, Timeout, MRef) ->
{trailers, Trailers};
{gun_push, ServerPid, StreamRef, NewStreamRef, Method, URI, Headers} ->
{push, NewStreamRef, Method, URI, Headers};
+ {gun_upgrade, ServerPid, StreamRef, Protocols, Headers} ->
+ {upgrade, Protocols, Headers};
+ {gun_ws, ServerPid, StreamRef, Frame} ->
+ {ws, Frame};
{gun_error, ServerPid, StreamRef, Reason} ->
{error, {stream_error, Reason}};
{gun_error, ServerPid, Reason} ->