WebSockex v0.2.0 WebSockex.Conn
Handles establishing and controlling the TCP connection.
Dispatches to the correct module for the underlying connection. (:gen_tcp
or :ssl
)
Is woefully inadequite for verifying proper peers in SSL connections.
Summary
Types
Options used when establishing a tcp or ssl connection
Functions
Builds the request to be sent along the newly opened socket
Closes the socket and returns the Conn map without the socket
Waits for the request response, decodes the packet, and returns the response headers
Returns a new WebSockex.Conn
struct from a uri and options
Opens a socket to a uri and returns a conn struct
Sets the socket to active
Sends data using the conn_mod
module
Types
connection_option :: {:extra_headers, [header]} | {:cacerts, [certification]} | {:insecure, boolean}
Options used when establishing a tcp or ssl connection.
:extra_headers
- defines other headers to be send in the opening request.:insecure
- Determines whether to verify the peer in a SSL connection. SSL peer verification is currenctly broken and only works in certain cases in which the:cacerts
are also provided. Sorry. Defaults totrue
.:cacerts
- The CA certifications for use in an secure connection when the:insecure
option isfalse
(has no effect when:insecure is true
). These certifications need a list of decoded binaries. See the Erlang:public_key
module for more information.
Functions
Builds the request to be sent along the newly opened socket.
The key parameter is part of the websocket handshake process.
Closes the socket and returns the Conn map without the socket.
When the :socket
field is nil
in the struct, the function just returns
the struct as is.
handle_response(WebSockex.Conn.t) :: {:ok, [header]} | {:error, reason :: term}
Waits for the request response, decodes the packet, and returns the response headers.
Sends any access information in the buffer back to the process as a message to be processed.
Returns a new WebSockex.Conn
struct from a uri and options.
Opens a socket to a uri and returns a conn struct.
set_active(WebSockex.Conn.t, true | false) :: :ok | {:error, reason :: term}
Sets the socket to active.
Sends data using the conn_mod
module.