CrossClj

1.10.0-alpha4 docs

SourceDocs



RECENT
    VARS
    *session*
    accept-connection
    lock
    parse-props
    repl
    repl-init
    repl-read
    required
    servers
    start-server
    start-servers
    stop-server
    stop-servers
    thread
    validate-opts
    with-lock

    « Index of all namespaces of this project

    Socket server support
    

    — Alex Miller

    Private
    (accept-connection conn name client-id in out err accept args)
    Start accept function, to be invoked on a client thread, given:
    conn - client socket
    name - server name
    client-id - client identifier
    in - in stream
    out - out stream
    err - err stream
    accept - accept fn symbol to invoke
    args - to pass to accept-fn
    Private
    (parse-props props)
    Parse clojure.server.* from properties to produce a map of server configs.
    
    (repl)
    REPL with predefined hooks for attachable socket server.
    
    (repl-init)
    Initialize repl in user namespace and make standard repl requires.
    
    (repl-read request-prompt request-exit)
    Enhanced :read hook for repl supporting :repl/quit.
    
    Private
    (required opts prop)
    Throw if opts does not contain prop.
    
    (start-server opts)
    Start a socket server given the specified opts:
     :address Host or address, string, defaults to loopback address
     :port Port, integer, required
     :name Name, required
     :accept Namespaced symbol of the accept function to invoke, required
     :args Vector of args to pass to accept function
     :bind-err Bind *err* to socket out stream?, defaults to true
     :server-daemon Is server thread a daemon?, defaults to true
     :client-daemon Are client threads daemons?, defaults to true
    Returns server socket.
    (start-servers system-props)
    Start all servers specified in the system properties.
    
    (stop-server)(stop-server name)
    Stop server with name or use the server-name from *session* if none supplied.
    Returns true if server stopped successfully, nil if not found, or throws if
    there is an error closing the socket.
    (stop-servers)
    Stop all servers ignores all errors, and returns nil.
    
    macroPrivate
    (thread name daemon & body)
    Private
    (validate-opts {:keys [name port accept], :as opts})
    Validate server config options
    
    macroPrivate
    (with-lock lock-expr & body)