Liking cljdoc? Tell your friends :D
Clojure only.

aleph.tcp


clientclj

(client {:keys [host port remote-address local-address ssl-context ssl?
                insecure? pipeline-transform bootstrap-transform epoll?
                transport]
         :or {bootstrap-transform identity epoll? false}
         :as options})

Given a host and port, returns a deferred which yields a duplex stream that can be used to communicate with the server.

Param keyDescription
hostthe hostname of the server.
portthe port of the server.
remote-addressa java.net.SocketAddress specifying the server's address.
local-addressa java.net.SocketAddress specifying the local network interface to use.
ssl-contextan explicit io.netty.handler.ssl.SslHandler or a map of SSL context options (see aleph.netty/ssl-client-context for more details) to use. Defers to ssl? and insecure? configuration if omitted.
ssl?if true, the client attempts to establish a secure connection with the server.
insecure?if true, the client will ignore the server's certificate.
bootstrap-transforma function that takes an io.netty.bootstrap.Bootstrap object, which represents the client, and modifies it.
pipeline-transforma function that takes an io.netty.channel.ChannelPipeline object, which represents a connection, and modifies it.
raw-stream?if true, messages from the stream will be io.netty.buffer.ByteBuf objects rather than byte-arrays. This will minimize copying, but means that care must be taken with Netty's buffer reference counting. Only recommended for advanced users.
transportthe transport to use, one of :nio, :epoll, :kqueue or :io-uring (defaults to :nio).
Given a host and port, returns a deferred which yields a duplex stream that can be used
to communicate with the server.

Param key               | Description
| ---                   | ---
| `host`                | the hostname of the server.
| `port`                | the port of the server.
| `remote-address`      | a `java.net.SocketAddress` specifying the server's address.
| `local-address`       | a `java.net.SocketAddress` specifying the local network interface to use.
| `ssl-context`         | an explicit `io.netty.handler.ssl.SslHandler` or a map of SSL context options (see `aleph.netty/ssl-client-context` for more details) to use. Defers to `ssl?` and `insecure?` configuration if omitted.
| `ssl?`                | if true, the client attempts to establish a secure connection with the server.
| `insecure?`           | if true, the client will ignore the server's certificate.
| `bootstrap-transform` | a function that takes an `io.netty.bootstrap.Bootstrap` object, which represents the client, and modifies it.
| `pipeline-transform`  | a function that takes an `io.netty.channel.ChannelPipeline` object, which represents a connection, and modifies it.
| `raw-stream?`         | if true, messages from the stream will be `io.netty.buffer.ByteBuf` objects rather than byte-arrays.  This will minimize copying, but means that care must be taken with Netty's buffer reference counting.  Only recommended for advanced users.
| `transport`           | the transport to use, one of `:nio`, `:epoll`, `:kqueue` or `:io-uring` (defaults to `:nio`).
sourceraw docstring

start-serverclj

(start-server handler
              {:keys [port socket-address ssl-context bootstrap-transform
                      pipeline-transform epoll? shutdown-timeout transport]
               :or {bootstrap-transform identity
                    pipeline-transform identity
                    epoll? false
                    shutdown-timeout netty/default-shutdown-timeout}
               :as options})

Takes a two-arg handler function which for each connection will be called with a duplex stream and a map containing information about the client. Returns a server object that can be shutdown via java.io.Closeable.close(), and whose port can be discovered via aleph.netty.port.

Param keyDescription
portthe port the server will bind to. If 0, the server will bind to a random port.
socket-addressa java.net.SocketAddress specifying both the port and interface to bind to.
ssl-contextan io.netty.handler.ssl.SslContext object or a map of SSL context options (see aleph.netty/ssl-server-context for more details). If given, the server will only accept SSL connections and call the handler once the SSL session has been successfully established. If a self-signed certificate is all that's required, (aleph.netty/self-signed-ssl-context) will suffice.
bootstrap-transforma function that takes an io.netty.bootstrap.ServerBootstrap object, which represents the server, and modifies it.
pipeline-transforma function that takes an io.netty.channel.ChannelPipeline object, which represents a connection, and modifies it.
raw-stream?if true, messages from the stream will be io.netty.buffer.ByteBuf objects rather than byte-arrays. This will minimize copying, but means that care must be taken with Netty's buffer reference counting. Only recommended for advanced users.
shutdown-timeoutinterval in seconds within which in-flight requests must be processed, defaults to 15 seconds. A value of 0 bypasses waiting entirely.
transportthe transport to use, one of :nio, :epoll, :kqueue or :io-uring (defaults to :nio).
Takes a two-arg handler function which for each connection will be called with a duplex
stream and a map containing information about the client.  Returns a server object that can
be shutdown via `java.io.Closeable.close()`, and whose port can be discovered via `aleph.netty.port`.

Param key               | Description
| ---                   | ---
| `port`                | the port the server will bind to.  If `0`, the server will bind to a random port.
| `socket-address`      | a `java.net.SocketAddress` specifying both the port and interface to bind to.
| `ssl-context`         | an `io.netty.handler.ssl.SslContext` object or a map of SSL context options (see `aleph.netty/ssl-server-context` for more details). If given, the server will only accept SSL connections and call the handler once the SSL session has been successfully established. If a self-signed certificate is all that's required, `(aleph.netty/self-signed-ssl-context)` will suffice.
| `bootstrap-transform` | a function that takes an `io.netty.bootstrap.ServerBootstrap` object, which represents the server, and modifies it.
| `pipeline-transform`  | a function that takes an `io.netty.channel.ChannelPipeline` object, which represents a connection, and modifies it.
| `raw-stream?`         | if true, messages from the stream will be `io.netty.buffer.ByteBuf` objects rather than byte-arrays.  This will minimize copying, but means that care must be taken with Netty's buffer reference counting.  Only recommended for advanced users.
| `shutdown-timeout`    | interval in seconds within which in-flight requests must be processed, defaults to 15 seconds. A value of 0 bypasses waiting entirely.
| `transport`           | the transport to use, one of `:nio`, `:epoll`, `:kqueue` or `:io-uring` (defaults to `:nio`).
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close