Skip to main content

websocket

function

babashka.http-client.websocket/websocket

(websocket [{:keys [client], :as opts}])
Builds `java.net.http.Websocket` client. * `:uri` - the uri to request (required). May be a string or map of `:scheme` (required), `:host` (required), `:port`, `:path` and `:query` * `:headers` - a map of headers for the initial handshake` * `:client` - a client as produced by `client`. If not provided a default client will be used. * `:connect-timeout` Sets a timeout for establishing a WebSocket connection (in millis). * `:subprotocols` - sets a request for the given subprotocols. * `:async` - return `CompleteableFuture` of websocket Callbacks options: * `:on-open` - `[ws]`, called when a `WebSocket` has been connected. * `:on-message` - `[ws data last]` A textual/binary data has been received. * `:on-ping` - `[ws data]` A Ping message has been received. * `:on-pong` - `[ws data]` A Pong message has been received. * `:on-close` - `[ws status reason]` Receives a Close message indicating the WebSocket's input has been closed. * `:on-error` - `[ws err]` An error has occurred.

No examples yet. Be the first to add one!