Adapter for the Jetty 9 server, with websocket + core.async support. Derived from ring.adapter.jetty
Adapter for the Jetty 9 server, with websocket + core.async support. Derived from ring.adapter.jetty
(any->parser-compliance pc)
(run-jetty {:as options
:keys [websocket-handler ring-handler host port accept-queue-size
max-threads min-threads input-buffer-size max-idle-time
ssl-port configurator parser-compliance daemon? ssl? join?
http2? http2c?]
:or {max-threads 50
max-idle-time 200000
input-buffer-size 8192
accept-queue-size 0
parser-compliance HttpCompliance/LEGACY
port 80
min-threads 8
join? true
daemon? false
ssl? false}})
Start a Jetty webserver to serve the given handler according to the supplied options:
:port
- the port to listen on (defaults to 80), can be a sequence:host
- the hostname to listen on:join?
- blocks the thread until server ends (defaults to true):http2?
- enable HTTP2 transport:http2c?
- enable HTTP2C transport (cleartext):configurator
- fn that will be passed the server instance before server.start():daemon?
- use daemon threads (defaults to false):ssl?
- allow connections over HTTPS:ssl-port
- the SSL port to listen on (defaults to 443, implies :ssl?):keystore
- the keystore to use for SSL connections:keystore-type
- the format of keystore:key-password
- the password to the keystore:truststore
- a truststore to use for SSL connections:truststore-type
- the format of trust store:trust-password
- the password to the truststore:accept-queue-size
- the accept queue size (also known as accept backlog):max-threads
- the maximum number of threads to use (default 50):min-threads
- the minimum number of threads to use (default 8):max-idle-time
- the maximum idle time in milliseconds for a connection (default 200000):ws-max-idle-time
- the maximum idle time in milliseconds for a websocket connection (default 500000):client-auth
- SSL client certificate authenticate, may be set to :need, :want or :none (defaults to :none):output-buffer-size
- (default 32768):input-buffer-size
- (default 8192):request-header-size
- (default 8192):response-header-size
- (default 8192):send-server-version?
- (default true):send-date-header?
- (default false):header-cache-size
- (default 512):websocket-handler
- a handler function that will receive a RING request map with the following keys added:
:in
: core.async chan that receives data sent by the client:out
: core async chan you can use to send data to client:ctrl
: core.async chan that received control messages such as: [::error e]
, [::close code reason]
:websocket-acceptor
: a function called with (request response) that returns a boolean whether to further process the
websocket request. If the function returns false, it is responsible for committing a response.
If the function return true, a websocket is created and the websocket-handler
is eventually
called.Start a Jetty webserver to serve the given handler according to the supplied options: * `:port` - the port to listen on (defaults to 80), can be a sequence * `:host` - the hostname to listen on * `:join?` - blocks the thread until server ends (defaults to true) * `:http2?` - enable HTTP2 transport * `:http2c?` - enable HTTP2C transport (cleartext) * `:configurator` - fn that will be passed the server instance before server.start() * `:daemon?` - use daemon threads (defaults to false) * `:ssl?` - allow connections over HTTPS * `:ssl-port` - the SSL port to listen on (defaults to 443, implies :ssl?) * `:keystore` - the keystore to use for SSL connections * `:keystore-type` - the format of keystore * `:key-password` - the password to the keystore * `:truststore` - a truststore to use for SSL connections * `:truststore-type` - the format of trust store * `:trust-password` - the password to the truststore * `:accept-queue-size` - the accept queue size (also known as accept backlog) * `:max-threads` - the maximum number of threads to use (default 50) * `:min-threads` - the minimum number of threads to use (default 8) * `:max-idle-time` - the maximum idle time in milliseconds for a connection (default 200000) * `:ws-max-idle-time` - the maximum idle time in milliseconds for a websocket connection (default 500000) * `:client-auth` - SSL client certificate authenticate, may be set to :need, :want or :none (defaults to :none) * `:output-buffer-size` - (default 32768) * `:input-buffer-size` - (default 8192) * `:request-header-size` - (default 8192) * `:response-header-size` - (default 8192) * `:send-server-version?` - (default true) * `:send-date-header?` - (default false) * `:header-cache-size` - (default 512) * `:websocket-handler` - a handler function that will receive a RING request map with the following keys added: * `:in`: core.async chan that receives data sent by the client * `:out`: core async chan you can use to send data to client * `:ctrl`: core.async chan that received control messages such as: `[::error e]`, `[::close code reason]` * `:websocket-acceptor`: a function called with (request response) that returns a boolean whether to further process the websocket request. If the function returns false, it is responsible for committing a response. If the function return true, a websocket is created and the `websocket-handler` is eventually called.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close