Connection

is a union of plain TCP and TLS-encrypted streams, allowing the HTTP client to dispatch send/read over either transport.

Plain

instantiate

(Fn [TcpStream] Connection)

creates a Plain.

Secure

instantiate

(Fn [TlsStream] Connection)

creates a Secure.

close

defn

(Fn [Connection] ())

                        (close conn)
                    

closes the connection, consuming it.

close!

defn

(Fn [(Ref Connection a)] ())

                        (close! conn)
                    

closes the connection by reference.

copy

instantiate

(Fn [(Ref Connection a)] Connection)

copies a Connection.

delete

instantiate

(Fn [Connection] ())

deletes a Connection. This should usually not be called manually.

get-tag

instantiate

(Fn [(Ref Connection a)] Int)

Gets the tag from a Connection.

prn

instantiate

(Fn [(Ref Connection a)] String)

converts a Connection to a string.

read

defn

(Fn [(Ref Connection a)] (Result String String))

                        (read conn)
                    

reads from the connection. Returns (Result String String).

send

defn

(Fn [(Ref Connection a), (Ref String b)] (Result Int String))

                        (send conn msg)
                    

sends a string over the connection.

str

instantiate

(Fn [(Ref Connection a)] String)

converts a Connection to a string.