Communication functions; copied for convenience into core
Communication functions; copied for convenience into core
(default-colorize-hook {:keys [cli text] :as arg})
Default hook fn for colorizing output, installed by default. Automatically strips color codes if the client has declared it doesn't support them.
Default hook fn for colorizing output, installed by default. Automatically strips color codes if the client has declared it doesn't support them.
(send! cli & body)
(send! process-extras cli & body)
Send text to the client. You can pass in a variable number of args, which may in turn be strings, vectors, or functions. Vectors will be treated as additional varargs (IE: (apply)'d to this function). Functions will be called with the client as a single argument, and the result sent as if it were passed directly. Strings, and any string returned by a function argument or in a vector, will be processed for color sequences (see the colors module).
Maps will be treated as telnet sequences (see telnet!) Strings are processed via the :process-send! hook, which is how the colors are applied. :process-send! is triggered with a map containing the recipient as :cli and the text as :text.
You may optionally provide a map as the first argument, before the client object, whose keys and values will also be passed along in the map for the :process-send! hook.
Send text to the client. You can pass in a variable number of args, which may in turn be strings, vectors, or functions. Vectors will be treated as additional varargs (IE: (apply)'d to this function). Functions will be called with the client as a single argument, and the result sent as if it were passed directly. Strings, and any string returned by a function argument or in a vector, will be processed for color sequences (see the colors module). Maps will be treated as telnet sequences (see telnet!) Strings are processed via the :process-send! hook, which is how the colors are applied. :process-send! is triggered with a map containing the recipient as :cli and the text as :text. You may optionally provide a map as the first argument, before the client object, whose keys and values will also be passed along in the map for the :process-send! hook.
(send-all! & body)
(send-all! process-extras & body)
Send text to every connected client. This is a convenience function. See send! for the meaning of the optional process-extras
Send text to every connected client. This is a convenience function. See send! for the meaning of the optional process-extras
(send-if! pred & body)
(send-if! process-extras pred & body)
Send text to every connected client for which (pred cli) returns true. The message body will be handled in the same way (send!) handles it. See send! for the meaning of the optional process-extras.
Send text to every connected client for which (pred cli) returns true. The message body will be handled in the same way (send!) handles it. See send! for the meaning of the optional process-extras.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close