(closed code reason)
When a closed message is sent via the output channel, the websocket will close with the supplied integer code and reason string.
When a closed message is sent via the output channel, the websocket will close with the supplied integer code and reason string.
(go-websocket [in out] & body)
(go-websocket [in out err] & body)
Macro for returning a websocket response handled by an inner go block. Expects three binding symbols - in, out and err - and assigns them to channels (see: websocket-listener). The body of the macro is executed in a core.async go block.
The err symbol may optionally be omitted. In that case, any websocket error will result in the socket being closed with a 1011 unexpected server error response.
Example: (go-websocket [in out err] (loop [] (when-let [msg (<! in)] (>! out msg) (recur))))
Macro for returning a websocket response handled by an inner go block. Expects three binding symbols - in, out and err - and assigns them to channels (see: websocket-listener). The body of the macro is executed in a core.async go block. The err symbol may optionally be omitted. In that case, any websocket error will result in the socket being closed with a 1011 unexpected server error response. Example: (go-websocket [in out err] (loop [] (when-let [msg (<! in)] (>! out msg) (recur))))
(websocket-listener in out err)
Takes three core.async channels for input, output, and error reporting respectively, and returns a Ring websocket listener.
Data sent to the 'in' channel will be sent to the client via the websocket. The 'out' channel will receive data sent from the client. The 'err' channel will deliver any Throwable exceptions that occur.
Closing the out channel will close the socket and the two other channels.
Takes three core.async channels for input, output, and error reporting respectively, and returns a Ring websocket listener. Data sent to the 'in' channel will be sent to the client via the websocket. The 'out' channel will receive data sent from the client. The 'err' channel will deliver any Throwable exceptions that occur. Closing the out channel will close the socket and the two other channels.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close