diff options
author | Loïc Hoguin <[email protected]> | 2019-09-26 13:16:56 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2019-09-26 13:20:28 +0200 |
commit | 00cc1f385f94823a0684deee001b643091e235b0 (patch) | |
tree | 6e5406fb62b71b17b29f1de42ccbe01c8c191547 /test/ws_SUITE.erl | |
parent | d86d55c1f90b37d991e20ad0f1ac37b1e38b36e1 (diff) | |
download | gun-00cc1f385f94823a0684deee001b643091e235b0.tar.gz gun-00cc1f385f94823a0684deee001b643091e235b0.tar.bz2 gun-00cc1f385f94823a0684deee001b643091e235b0.zip |
Add reply_to option to ws_upgrade; remove notowner entirely
The reply_to option is also propagated when we switch protocols.
Diffstat (limited to 'test/ws_SUITE.erl')
-rw-r--r-- | test/ws_SUITE.erl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ws_SUITE.erl b/test/ws_SUITE.erl index 55cdfba..d4413fb 100644 --- a/test/ws_SUITE.erl +++ b/test/ws_SUITE.erl @@ -122,6 +122,24 @@ reject_upgrade(Config) -> error(timeout) end. +reply_to(Config) -> + doc("Ensure we can send a list of frames in one gun:ws_send call."), + Self = self(), + Frame = {text, <<"Hello!">>}, + ReplyTo = spawn(fun() -> + {ConnPid, StreamRef} = receive Msg -> Msg after 1000 -> error(timeout) end, + {upgrade, [<<"websocket">>], _} = gun:await(ConnPid, StreamRef), + Self ! {self(), ready}, + {ws, Frame} = gun:await(ConnPid, StreamRef), + Self ! {self(), ok} + end), + {ok, ConnPid} = gun:open("localhost", config(port, Config)), + {ok, _} = gun:await_up(ConnPid), + StreamRef = gun:ws_upgrade(ConnPid, "/", [], #{reply_to => ReplyTo}), + ReplyTo ! {ConnPid, StreamRef}, + receive {ReplyTo, ready} -> gun:ws_send(ConnPid, Frame) after 1000 -> error(timeout) end, + receive {ReplyTo, ok} -> gun:close(ConnPid) after 1000 -> error(timeout) end. + send_many(Config) -> doc("Ensure we can send a list of frames in one gun:ws_send call."), {ok, ConnPid} = gun:open("localhost", config(port, Config)), |