From eb808a3f8bbd97d2a2ea0114b43b708a17b44066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 11 Apr 2025 14:34:51 +0200 Subject: Gun 2.2.0 --- docs/en/gun/2.2/manual/gun_ws_protocol/index.html | 235 ++++++++++++++++++++++ 1 file changed, 235 insertions(+) create mode 100644 docs/en/gun/2.2/manual/gun_ws_protocol/index.html (limited to 'docs/en/gun/2.2/manual/gun_ws_protocol') diff --git a/docs/en/gun/2.2/manual/gun_ws_protocol/index.html b/docs/en/gun/2.2/manual/gun_ws_protocol/index.html new file mode 100644 index 00000000..67383298 --- /dev/null +++ b/docs/en/gun/2.2/manual/gun_ws_protocol/index.html @@ -0,0 +1,235 @@ + + + + + + + + + + Nine Nines: gun_ws_protocol(3) + + + + + + + + + + + + + + + +
+
+
+
+ +

gun_ws_protocol(3)

+ +

Name

+

gun_ws_protocol - Websocket subprotocols

+

Description

+

The gun_ws_protocol module provides the callback interface and types for implementing Websocket subprotocols.

+

Callbacks

+

Websocket subprotocols implement the following interface.

+

init

+
+
init(ReplyTo, StreamRef, Headers, Opts) -> {ok, State}
+
+ReplyTo   :: pid()
+StreamRef :: reference()
+Headers   :: cow_http:headers()
+Opts      :: gun:ws_opts()
+State     :: protocol_state()
+
+

Initialize the Websocket protocol.

+
ReplyTo
+

The pid of the process that owns the stream and to which messages will be sent to.

+
+
StreamRef
+

The reference for the stream. Must be sent in messages to distinguish between different streams.

+
+
Headers
+

Headers that were sent in the response establishing the Websocket connection.

+
+
Opts
+

Websocket options. Custom options can be provided in the user_opts key.

+
+
State
+

State for the protocol.

+
+
+

handle

+
+
handle(Frame, State) -> {ok, FlowDec, State}
+
+Frame   :: cow_ws:frame()
+State   :: protocol_state()
+FlowDec :: non_neg_integer()
+
+

Handle a Websocket frame.

+

This callback may receive fragmented frames depending on the protocol and may need to rebuild the full frame to process it.

+
Frame
+

Websocket frame.

+
+
State
+

State for the protocol.

+
+
FlowDec
+

How many messages were sent. Used to update the flow control state when the feature is enabled.

+
+
+

Types

+

protocol_state()

+
+
protocol_state() :: any()
+
+

State for the protocol.

+

As this part of the implementation of the protocol the type may differ between different Websocket protocol modules.

+

Changelog

+
  • 2.0: Module introduced. +
  • +
+

See also

+

gun(7), gun(3), gun:ws_upgrade(3)

+ + + + + + +
+ +
+ + +

+ Gun + 2.2 + Function Reference + +

+ + + +

Navigation

+ +

Version select

+ + +

Like my work? Donate!

+

Donate to Loïc Hoguin because his work on Cowboy, Ranch, Gun and Erlang.mk is fantastic:

+
+ + + + + + + + + +

Recurring payment options are also available via GitHub Sponsors. These funds are used to cover the recurring expenses like food, dedicated servers or domain names.

+ + + +
+
+
+
+ + + + + + + + + -- cgit v1.2.3