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?]
         :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.

|:---|:---- | 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 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.

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

|:---|:----
| `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` 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.
raw docstring

start-serverclj

(start-server
  handler
  {:keys [port socket-address ssl-context bootstrap-transform pipeline-transform
          epoll?]
   :or {bootstrap-transform identity pipeline-transform identity epoll? false}
   :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.

|:---|:----- | 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. 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.

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`.

|:---|:-----
| `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. 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.
raw docstring

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

× close