WebSocket channel API for sending and receiving messages.
WebSocket channel API for sending and receiving messages.
(going-away)
(going-away reason)
The code 1001
indicates that an endpoint is "going away", such as a
server going down or a browser having navigated away from a page.
The code `1001` indicates that an endpoint is "going away", such as a server going down or a browser having navigated away from a page.
(missing-extensions reason)
The code 1010
indicates that an endpoint (client) is terminating the
connection because it has expected the server to negotiate one or more
extension, but the server didn't return them in the response message of the
WebSocket handshake. The list of extensions that are needed SHOULD appear in
the /reason/ part of the Close frame. Note that this status code is not used
by the server, because it can fail the WebSocket handshake instead.
The code `1010` indicates that an endpoint (client) is terminating the connection because it has expected the server to negotiate one or more extension, but the server didn't return them in the response message of the WebSocket handshake. The list of extensions that are needed SHOULD appear in the /reason/ part of the Close frame. Note that this status code is not used by the server, because it can fail the WebSocket handshake instead.
(msg-contains-invalid-data)
(msg-contains-invalid-data reason)
The code 1007
indicates that an endpoint is terminating the connection
because it has received data within a message that was not consistent with the
type of the message (e.g., non-UTF-8 data within a text message).
The code `1007` indicates that an endpoint is terminating the connection because it has received data within a message that was not consistent with the type of the message (e.g., non-UTF-8 data within a text message).
(msg-too-big)
(msg-too-big reason)
The code 1009
indicates that an endpoint is terminating the connection
because it has received a message that is too big for it to process.
The code `1009` indicates that an endpoint is terminating the connection because it has received a message that is too big for it to process.
(msg-violates-policy)
(msg-violates-policy reason)
The code 1008
indicates that an endpoint is terminating the connection
because it has received a message that violates its policy. This is a generic
status code that can be returned when there is no other more suitable status
code (e.g., 1003 or 1009) or if there is a need to hide specific details about
the policy.
The code `1008` indicates that an endpoint is terminating the connection because it has received a message that violates its policy. This is a generic status code that can be returned when there is no other more suitable status code (e.g., 1003 or 1009) or if there is a need to hide specific details about the policy.
(normal-closure)
The code 1000
indicates a normal closure, meaning that the purpose for
which the connection was established has been fulfilled.
The code `1000` indicates a normal closure, meaning that the purpose for which the connection was established has been fulfilled.
(protocol-error)
(protocol-error reason)
The code 1002
indicates that an endpoint is terminating the connection due
to a protocol error.
The code `1002` indicates that an endpoint is terminating the connection due to a protocol error.
(unexpected-error)
(unexpected-error reason)
The code 1011
indicates that a server is terminating the connection because
it encountered an unexpected condition that prevented it from fulfilling the
request.
The code `1011` indicates that a server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request.
(unsupported-data)
(unsupported-data reason)
The code 1003
indicates that an endpoint is terminating the connection
because it has received a type of data it cannot accept (e.g., an endpoint
that understands only text data MAY send this if it receives a binary
message).
The code `1003` indicates that an endpoint is terminating the connection because it has received a type of data it cannot accept (e.g., an endpoint that understands only text data MAY send this if it receives a binary message).
(send-binary data chan opts)
Sends a complete binary message, invoking the callback when complete.
data
The binary data to send.chan
The web socket channel of type WebSocketChannel
.opts
The map with options:
:callback
The WebSocketCallback
to invoke on completion.
:on-complete
The function (fn [{:keys [callback, channel]}] ...)
.:on-error
The function (fn [{:keys [callback, channel, error]}] ...)
:timeout
The timeout in milliseconds, long. No timeout by default.Sends a complete binary message, invoking the callback when complete. 1) `data` The binary data to send. 2) `chan` The web socket channel of type `WebSocketChannel`. 3) `opts` The map with options: - `:callback` The `WebSocketCallback` to invoke on completion. + The callback can be declared as map with keys: - `:on-complete` The function `(fn [{:keys [callback, channel]}] ...)`. - `:on-error` The function `(fn [{:keys [callback, channel, error]}] ...)` + The callback can be also just a function which receives a map with keys described above. - `:timeout` The timeout in milliseconds, long. No timeout by default.
(send-binary!! data chan)
Sends a complete binary message using blocking IO.
data
The binary data to send.chan
The web socket channel of type WebSocketChannel
.Sends a complete binary message using blocking IO. 1) `data` The binary data to send. 2) `chan` The web socket channel of type `WebSocketChannel`.
(send-close message chan opts)
Sends a complete close message, invoking the callback when complete.
message
The close message as instance of CloseMessage
.
nil
then normal-closure
is sent.chan
The web socket channel of type WebSocketChannel
.
opts
The map with options:
:callback
The WebSocketCallback
to invoke on completion.
:on-complete
The function (fn [{:keys [callback, channel]}] ...)
.:on-error
The function (fn [{:keys [callback, channel, error]}] ...)
Sends a complete close message, invoking the callback when complete. 1) `message` The close message as instance of `CloseMessage`. + See helper functions to create messages above. + If `nil` then [[normal-closure]] is sent. 2) `chan` The web socket channel of type `WebSocketChannel`. 3) `opts` The map with options: - `:callback` The `WebSocketCallback` to invoke on completion. + The callback can be declared as map with keys: - `:on-complete` The function `(fn [{:keys [callback, channel]}] ...)`. - `:on-error` The function `(fn [{:keys [callback, channel, error]}] ...)` + The callback can be also just a function which receives a map with keys described above.
(send-close!! message chan)
Sends a complete close message using blocking IO.
message
The close message as instance of CloseMessage
.
nil
then normal-closure
is sent.chan
The web socket channel of type WebSocketChannel
.
Sends a complete close message using blocking IO. 1) `message` The close message as instance of `CloseMessage`. + See helper functions to create messages above. + If `nil` then [[normal-closure]] is sent. 2) `chan` The web socket channel of type `WebSocketChannel`.
(send-text text chan opts)
Sends a complete text message, invoking the callback when complete.
text
The text string to send.chan
The web socket channel of type WebSocketChannel
.opts
The map with options:
:callback
The WebSocketCallback
to invoke on completion.
:on-complete
The function (fn [{:keys [callback, channel]}] ...)
.:on-error
The function (fn [{:keys [callback, channel, error]}] ...)
:timeout
The timeout in milliseconds, long. No timeout by default.Sends a complete text message, invoking the callback when complete. 1) `text` The text string to send. 2) `chan` The web socket channel of type `WebSocketChannel`. 3) `opts` The map with options: - `:callback` The `WebSocketCallback` to invoke on completion. + The callback can be declared as map with keys: - `:on-complete` The function `(fn [{:keys [callback, channel]}] ...)`. - `:on-error` The function `(fn [{:keys [callback, channel, error]}] ...)` + The callback can be also just a function which receives a map with keys described above. - `:timeout` The timeout in milliseconds, long. No timeout by default.
(send-text!! text chan)
Sends a complete text message using blocking IO.
text
The text string to send.chan
The web socket channel of type WebSocketChannel
.Sends a complete text message using blocking IO. 1) `text` The text string to send. 2) `chan` The web socket channel of type `WebSocketChannel`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close