Skip to main content

org.httpkit.server

A

  • as-channel

    Returns `{:body ch}`, where `ch` is the request's underlying asynchronous HTTP or WebSocket `AsyncChannel`. Main op...

C

  • close

    Closes the channel. Idempotent: returns true if the channel was actually closed, or false if it was already closed.

O

  • on-close

    Sets handler (fn [status-code]) for notification of channel being closed by the server or client. Handler will be in...

R

  • run-server

    Starts a mostly[1] Ring-compatible HttpServer with options: :ip ; Which IP to bind (default: 0.0.0....

S

  • send!

    Sends data to client and returns true if the data was successfully sent, or false if the channel is closed. Data is ...

  • send-checked-websocket-handshake!

    Given an AsyncChannel and `sec-ws-accept` string, unconditionally sends handshake to upgrade given AsyncChannel to a W...

  • send-websocket-handshake!

    Returns true iff successfully upgraded a valid WebSocket request.

  • server-port

    Given an HttpServer, returns server's local port.

  • server-status

    Given an HttpServer, returns server's status e/o #{:stopped :running :stopping}.

  • server-stop!

    Signals given `HttpServer` to stop. If already stopping: returns nil. If not already stopping: returns a Promis...

W

  • websocket-handshake-check

    Returns `sec-ws-accept` string iff given Ring request is a valid WebSocket handshake.

  • with-channel

    DEPRECATED: this macro has potential race conditions, Ref. #318. Prefer `as-channel` instead.