(upgrade-websocket req res ws options)
(upgrade-websocket req
res
async-context
ws
{:as _options
:keys [ws-max-idle-time ws-max-text-message-size]
:or {ws-max-idle-time 500000
ws-max-text-message-size 65536}})
(-ping! x ws)
How to encode bytes sent with a ping
How to encode bytes sent with a ping
(close! this)
(close! this status-code reason)
(connected? this)
(idle-timeout! this ms)
(ping! this)
(ping! this msg)
(remote-addr this)
(req-of this)
(send! this msg)
(send! this msg callback)
(-send! x ws)
(-send! x ws callback)
How to encode content sent to the WebSocket clients
How to encode content sent to the WebSocket clients
(ws-upgrade-request? {:keys [headers]})
Checks if a request is a websocket upgrade request.
It is a websocket upgrade request when it contains the following headers:
Checks if a request is a websocket upgrade request. It is a websocket upgrade request when it contains the following headers: - connection: upgrade - upgrade: websocket
(ws-upgrade-response ws-handler)
Returns a websocket upgrade response.
ws-handler must be a map of handler fns: {:on-connect #(create-fn %) ; ^WebSocketAdapter ws :on-text #(text-fn % %2) ; ^WebSocketAdapter ws message :on-bytes #(binary-fn % %2 %3 %4) ; ^WebSocketAdapter ws payload offset len :on-close #(close-fn % %2 %3) ; ^WebSocketAdapter ws statusCode reason :on-error #(error-fn % %2)} ; ^WebSocketAdapter ws e or a custom creator function take upgrade request as parameter and returns a handler fns map, negotiated subprotocol and extensions (or error info).
The response contains HTTP status 101 (Switching Protocols) and the following headers:
Returns a websocket upgrade response. ws-handler must be a map of handler fns: {:on-connect #(create-fn %) ; ^WebSocketAdapter ws :on-text #(text-fn % %2) ; ^WebSocketAdapter ws message :on-bytes #(binary-fn % %2 %3 %4) ; ^WebSocketAdapter ws payload offset len :on-close #(close-fn % %2 %3) ; ^WebSocketAdapter ws statusCode reason :on-error #(error-fn % %2)} ; ^WebSocketAdapter ws e or a custom creator function take upgrade request as parameter and returns a handler fns map, negotiated subprotocol and extensions (or error info). The response contains HTTP status 101 (Switching Protocols) and the following headers: - connection: upgrade - upgrade: websocket
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close