Liking cljdoc? Tell your friends :D

taoensso.telemere.sockets

Basic TCP/UDP socket handlers.

a-handler:tcp-socketclj

(a-handler:tcp-socket)
(a-handler:tcp-socket signal)
source

a-handler:udp-socketclj

(a-handler:udp-socket)
(a-handler:udp-socket signal)
source

handler:tcp-socketclj

(handler:tcp-socket host port)
(handler:tcp-socket host
                    port
                    {:keys [socket-opts output-fn]
                     :or {output-fn (utils/format-signal-fn)}})
Experimental, subject to change. Feedback welcome!

Returns a (fn handler [signal]) that:
  - Takes a Telemere signal.
  - Sends formatted signal string to specified TCP socket.

Options:
  `host` - Destination TCP socket hostname string
  `port` - Destination TCP socket port int

  `:socket-opts` - {:keys [ssl? connect-timeout-msecs]}
  `:output-fn`   - (fn [signal]) => output string, see `format-signal-fn` or `pr-signal-fn`

Limitations:
  - Failed writes will be retried only once.
  - Writes lock on a single underlying socket, so IO won't benefit from adding
    extra handler threads. Let me know if there's demand for socket pooling.
source

handler:udp-socketclj

(handler:udp-socket host port)
(handler:udp-socket host
                    port
                    {:keys [output-fn max-packet-bytes truncation-warning-fn]
                     :or {output-fn (utils/format-signal-fn)
                          max-packet-bytes 512}})
Experimental, subject to change. Feedback welcome!

Returns a (fn handler [signal]) that:
  - Takes a Telemere signal.
  - Sends formatted signal string to specified UDP socket.

Options:
  `host` - Destination UDP socket hostname string
  `port` - Destination UDP socket port int

  `:output-fn`             - (fn [signal]) => output string, see `format-signal-fn` or `pr-signal-fn`
  `:max-packet-bytes`      - Max packet size (in bytes) before truncating output (default 512)
  `:truncation-warning-fn` - Optional (fn [{:keys [max actual signal]}]) to call whenever
                             output is truncated. Should be appropriately rate-limited!

Limitations:
  - Due to UDP limitations, truncates output to `max-packet-bytes`!
  - Failed writes will be retried only once.
  - Writes lock on a single underlying socket, so IO won't benefit from adding
    extra handler threads. Let me know if there's demand for socket pooling.
  - No DTLS (Datagram Transport Layer Security) support,
    please let me know if there's demand.
source

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

× close