diff options
author | Loïc Hoguin <[email protected]> | 2020-11-12 14:00:41 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2020-11-12 14:00:41 +0100 |
commit | 4a58077d5162325fa5723690e58e7364adbcb18c (patch) | |
tree | 6f088a7a9b9d1f6b0eacdeb98de1eb5b8032b647 /test | |
parent | 1ebad8acf803eb797a6c61f6522ebc3b79f104a1 (diff) | |
download | gun-4a58077d5162325fa5723690e58e7364adbcb18c.tar.gz gun-4a58077d5162325fa5723690e58e7364adbcb18c.tar.bz2 gun-4a58077d5162325fa5723690e58e7364adbcb18c.zip |
Replace gun:ws_send/2 with gun:ws_send/3
Switching from /2 to /3 should be easy enough.
Also update the documentation about HTTP/2 Websocket support.
Diffstat (limited to 'test')
-rw-r--r-- | test/flow_SUITE.erl | 12 | ||||
-rw-r--r-- | test/shutdown_SUITE.erl | 6 | ||||
-rw-r--r-- | test/ws_autobahn_SUITE.erl | 6 |
3 files changed, 12 insertions, 12 deletions
diff --git a/test/flow_SUITE.erl b/test/flow_SUITE.erl index feb5b2e..9425ed3 100644 --- a/test/flow_SUITE.erl +++ b/test/flow_SUITE.erl @@ -183,9 +183,9 @@ flow_ws(_) -> %% We send 2 frames with some time in between to make sure that %% Gun handles them in separate Protocol:handle calls. Frame = {text, <<"Hello!">>}, - gun:ws_send(ConnPid, Frame), + gun:ws_send(ConnPid, StreamRef, Frame), timer:sleep(500), - gun:ws_send(ConnPid, Frame), + gun:ws_send(ConnPid, StreamRef, Frame), %% We set the flow to 1 therefore we will receive 1 data message, %% and then nothing because Gun doesn't read from the socket. {ws, _} = gun:await(ConnPid, StreamRef), @@ -193,9 +193,9 @@ flow_ws(_) -> %% We then update the flow, send 2 frames with some time in between %% and get 2 more data messages but no more. gun:update_flow(ConnPid, StreamRef, 2), - gun:ws_send(ConnPid, Frame), + gun:ws_send(ConnPid, StreamRef, Frame), timer:sleep(500), - gun:ws_send(ConnPid, Frame), + gun:ws_send(ConnPid, StreamRef, Frame), {ws, _} = gun:await(ConnPid, StreamRef), {ws, _} = gun:await(ConnPid, StreamRef), {error, timeout} = gun:await(ConnPid, StreamRef, 1000), @@ -259,9 +259,9 @@ no_flow_ws(_) -> {upgrade, [<<"websocket">>], _} = gun:await(ConnPid, StreamRef), gun:update_flow(ConnPid, StreamRef, 2), Frame = {text, <<"Hello!">>}, - gun:ws_send(ConnPid, Frame), + gun:ws_send(ConnPid, StreamRef, Frame), timer:sleep(100), - gun:ws_send(ConnPid, Frame), + gun:ws_send(ConnPid, StreamRef, Frame), {ws, _} = gun:await(ConnPid, StreamRef), {ws, _} = gun:await(ConnPid, StreamRef), gun:close(ConnPid) diff --git a/test/shutdown_SUITE.erl b/test/shutdown_SUITE.erl index 27e9f4b..3b3ddf2 100644 --- a/test/shutdown_SUITE.erl +++ b/test/shutdown_SUITE.erl @@ -534,7 +534,7 @@ ws_gun_send_close_frame(Config) -> %% We send a close frame. We expect the same frame back %% before the connection is closed. Frame = {close, 3333, <<>>}, - gun:ws_send(ConnPid, Frame), + gun:ws_send(ConnPid, StreamRef, Frame), {ws, Frame} = gun:await(ConnPid, StreamRef), gun_is_down(ConnPid, ConnRef, normal). @@ -563,7 +563,7 @@ closing_gun_shutdown(Config) -> %% We send a close frame then immediately call gun:shutdown/1. %% We expect Gun to go down without retrying to reconnect. Frame = {close, 3333, <<>>}, - gun:ws_send(ConnPid, Frame), + gun:ws_send(ConnPid, StreamRef, Frame), gun:shutdown(ConnPid), {ws, Frame} = gun:await(ConnPid, StreamRef), gun_is_down(ConnPid, ConnRef, shutdown). @@ -586,7 +586,7 @@ do_closing_owner_down(Config, ExitReason, DownReason) -> {ok, http} = gun:await_up(ConnPid), StreamRef = gun:ws_upgrade(ConnPid, "/ws_frozen", []), {upgrade, [<<"websocket">>], _} = gun:await(ConnPid, StreamRef), - gun:ws_send(ConnPid, {close, 3333, <<>>}), + gun:ws_send(ConnPid, StreamRef, {close, 3333, <<>>}), timer:sleep(100), exit(ExitReason) end), diff --git a/test/ws_autobahn_SUITE.erl b/test/ws_autobahn_SUITE.erl index 0caf108..69894d7 100644 --- a/test/ws_autobahn_SUITE.erl +++ b/test/ws_autobahn_SUITE.erl @@ -115,13 +115,13 @@ run_cases(N, Total) -> loop(Pid, MRef, StreamRef) -> receive {gun_ws, Pid, StreamRef, close} -> - gun:ws_send(Pid, close), + gun:ws_send(Pid, StreamRef, close), loop(Pid, MRef, StreamRef); {gun_ws, Pid, StreamRef, {close, Code, _}} -> - gun:ws_send(Pid, {close, Code, <<>>}), + gun:ws_send(Pid, StreamRef, {close, Code, <<>>}), loop(Pid, MRef, StreamRef); {gun_ws, Pid, StreamRef, Frame} -> - gun:ws_send(Pid, Frame), + gun:ws_send(Pid, StreamRef, Frame), loop(Pid, MRef, StreamRef); {gun_down, Pid, ws, _, _} -> close(Pid, MRef); |