(send-websocket-handshake! ch ring-req)
Returns true iff successfully upgraded a valid WebSocket request.
Source
(defn send-websocket-handshake!
"Returns true iff successfully upgraded a valid WebSocket request."
[^AsyncChannel ch ring-req]
(when-let [sec-ws-key (get-in ring-req [:headers "sec-websocket-key"])]
(when-let [sec-ws-accept (try (sec-websocket-accept sec-ws-key)
(catch Exception _))]
(.sendHandshake ch
{"Upgrade" "websocket"
"Connection" "Upgrade"
"Sec-WebSocket-Accept" sec-ws-accept})
true)))