net.http
call-api
added in 4.1.4
(call-api path method opts)(call-api base-url path method {:keys [path-params query-params header-params cookie-params body content-type accepts], :as opts})Call an API by making an HTTP request and return its response.
close!
added in 3.0
(close! ws)(close! ws status-code reason)Initiates an orderly closure of this WebSocket’s output by sending a Close message with the given status code and the reason.
event-stream
added in 4.0
(event-stream url & [opts])creates a data-stream for checking errors
http-client
added in 3.0
(http-client)(http-client opts)constructor for java.net.http.HttpClient
(http-client) => java.net.http.HttpClient
http-request
added in 3.0
(http-request req)(http-request req method {:keys [expect-continue? headers timeout version body], :as opts})constructor for java.net.http.HttpRequest
(http-request “http://www.yahoo.com”) => java.net.http.HttpRequest
mock-endpoint
added in 3.0
(mock-endpoint handler route)(mock-endpoint handler route {:keys [format], :or {format :edn}})remote
added in 3.0
(remote url {:keys [id args format], :as opts, :or {format :edn}})creates a remote access to an endpoint
request
added in 3.0
(request req)(request uri {:keys [client as raw type callback error method handler], :as opts, :or {type :sync, as :string, method :get, client (clojure.core/deref +default-client+)}})performs a http request
send!
added in 3.0
(send! ws data)(send! ws data {:keys [last?], :or {last? true}})Sends a message to the WebSocket.
data can be a CharSequence (e.g. string) or ByteBuffer
websocket
added in 3.0
(websocket uri {:keys [on-open on-message on-ping on-pong on-close on-error], :as opts})Builds a new WebSocket connection from a request object and returns a future connection.
Arguments:
uria websocket uriopts(optional), a map of::http-clientAn HttpClient - will use a default HttpClient if not provided:listenerA WebSocket$Listener - alternatively will be created from the handlers passed into opts: :on-open, :on-message, :on-ping, :on-pong, :on-close, :on-error:headersAdds the given name-value pair to the list of additional HTTP headers sent during the opening handshake.:connect-timeoutSets a timeout for establishing a WebSocket connection (in millis).:subprotocolsSets a request for the given subprotocols.