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/guide/websocket.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/guide/websocket.asciidoc')
-rw-r--r-- | doc/src/guide/websocket.asciidoc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/doc/src/guide/websocket.asciidoc b/doc/src/guide/websocket.asciidoc index 287b3f7..ba06e2c 100644 --- a/doc/src/guide/websocket.asciidoc +++ b/doc/src/guide/websocket.asciidoc @@ -49,7 +49,7 @@ undocumented and must be set to `gun_ws_h`. .Upgrade to Websocket with protocol negotiation [source,erlang] ---- -gun:ws_upgrade(ConnPid, "/websocket", [] +StreamRef = gun:ws_upgrade(ConnPid, "/websocket", [] #{protocols => [{<<"xmpp">>, gun_ws_h}]}). ---- @@ -88,18 +88,18 @@ Once the Websocket upgrade has completed successfully, you no longer have access to functions for performing requests. You can only send and receive Websocket messages. -Use `gun:ws_send/2` to send messages to the server. +Use `gun:ws_send/3` to send messages to the server. .Send a text frame [source,erlang] ---- -gun:ws_send(ConnPid, {text, "Hello!"}). +gun:ws_send(ConnPid, StreamRef, {text, "Hello!"}). ---- .Send a text frame, a binary frame and then close the connection [source,erlang] ---- -gun:ws_send(ConnPid, [ +gun:ws_send(ConnPid, StreamRef, [ {text, "Hello!"}, {binary, BinaryValue}, close |