View Source Sock.Socket protocol (Sock v0.2.0)

A protocol to provide the ability for Sock implementations to send data to a connected WebSocket client. An instance of an (otherwise opaque) type conforming to this protocol is passed in to Sock implementations as the first argument of most Sock callbacks.

Link to this section Summary

Functions

Sends the specified data to the client as a binary frame(s).

Sends the data to the client within a ping frame.

Sends the data to the client within a pong frame. Note that Sock implementation should not send pong frames in response to ping frames on their own, since the backing implementation is expected to do this automatically. This function is present solely for purpose of proactively sending pong frames as a unidirectional heartbeat per RFC6455§5.3.3.

Sends the specified data to the client as a text frame(s).

Link to this section Types

Link to this section Functions

Link to this function

send_binary_frame(socket, data)

View Source
@spec send_binary_frame(socket :: t(), data :: binary()) :: :ok

Sends the specified data to the client as a binary frame(s).

An implementation is permitted to send this data as one or more binary / continuation frames at its discretion.

Link to this function

send_ping_frame(socket, data)

View Source
@spec send_ping_frame(socket :: t(), data :: binary()) :: :ok

Sends the data to the client within a ping frame.

Link to this function

send_pong_frame(socket, data)

View Source
@spec send_pong_frame(socket :: t(), data :: binary()) :: :ok

Sends the data to the client within a pong frame. Note that Sock implementation should not send pong frames in response to ping frames on their own, since the backing implementation is expected to do this automatically. This function is present solely for purpose of proactively sending pong frames as a unidirectional heartbeat per RFC6455§5.3.3.

Link to this function

send_text_frame(socket, data)

View Source
@spec send_text_frame(socket :: t(), data :: binary()) :: :ok

Sends the specified data to the client as a text frame(s).

An implementation is permitted to send this data as one or more text / continuation frames at its discretion.