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 /doc/src/manual/gun.ws_send.asciidoc | |
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 'doc/src/manual/gun.ws_send.asciidoc')
-rw-r--r-- | doc/src/manual/gun.ws_send.asciidoc | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/doc/src/manual/gun.ws_send.asciidoc b/doc/src/manual/gun.ws_send.asciidoc index b39f3f0..224472e 100644 --- a/doc/src/manual/gun.ws_send.asciidoc +++ b/doc/src/manual/gun.ws_send.asciidoc @@ -8,13 +8,14 @@ gun:ws_send - Send Websocket frames [source,erlang] ---- -ws_send(ConnPid, Frames) -> ok - -ConnPid :: pid() -Frames :: Frame | [Frame] -Frame :: close | ping | pong - | {text | binary | close | ping | pong, iodata()} - | {close, non_neg_integer(), iodata()} +ws_send(ConnPid, StreamRef, Frames) -> ok + +ConnPid :: pid() +StreamRef :: gun:stream_ref() +Frames :: Frame | [Frame] +Frame :: close | ping | pong + | {text | binary | close | ping | pong, iodata()} + | {close, non_neg_integer(), iodata()} ---- Send Websocket frames. @@ -28,6 +29,10 @@ ConnPid:: The pid of the Gun connection process. +StreamRef:: + +Identifier of the stream that was upgraded to Websocket. + Frames:: One or more Websocket frame(s). @@ -38,6 +43,8 @@ The atom `ok` is returned. == Changelog +* *2.0*: The mandatory `StreamRef` argument was added. +* *2.0*: It is now possible to send multiple frames at once. * *1.0*: Function introduced. == Examples @@ -45,13 +52,13 @@ The atom `ok` is returned. .Send a single frame [source,erlang] ---- -gun:ws_send(ConnPid, {text, <<"Hello world!">>}). +gun:ws_send(ConnPid, StreamRef, {text, <<"Hello world!">>}). ---- .Send many frames including a close frame [source,erlang] ---- -gun:ws_send(ConnPid, [ +gun:ws_send(ConnPid, StreamRef, [ {text, <<"See you later, world!">>}, close ]). |