From cff0a87d3cbdcf67a9049cdc2784d459711e2867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 10 Apr 2015 16:34:21 +0300 Subject: Add Websocket options Allow passing Websocket options through either open or ws_upgrade. Document ws_upgrade/4. --- doc/src/guide/websocket.asciidoc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'doc/src/guide') diff --git a/doc/src/guide/websocket.asciidoc b/doc/src/guide/websocket.asciidoc index 23c5030..83a8384 100644 --- a/doc/src/guide/websocket.asciidoc +++ b/doc/src/guide/websocket.asciidoc @@ -14,7 +14,7 @@ HTTP/1.1 connections can be upgraded to Websocket, so you might need to restrict the protocol to HTTP/1.1 if you are planning to use Websocket over TLS. -You must use the `gun_ws:upgrade/{2,3}` function to upgrade +You must use the `gun_ws:upgrade/{2,3,4}` function to upgrade to Websocket. This function can be called anytime after connection, so you can send HTTP requests before upgrading to Websocket. @@ -34,6 +34,12 @@ gun:ws_upgrade(ConnPid, "/websocket", [ {<<"sec-websocket-protocol">>, "mychat"} ]). +You can pass the Websocket options as part of the `gun:open/{2,3}` +call when opening the connection, or using the `gun:ws_upgrade/4`. +The fourth argument is those same options. This function call +will crash if the options are incorrect, unlike when passing +them through `gun:open/{2,3}`. + The success or failure of this operation will be sent as a message. -- cgit v1.2.3