Liking cljdoc? Tell your friends :D

ring.websocket.async


closedclj

(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.
sourceraw docstring

go-websocketcljmacro

(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. At the end of the body, the socket is closed.

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. At the end of the body, the socket is closed.

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))))
sourceraw docstring

websocket-listenerclj

(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.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close