ring.websocket

Protocols and utility functions for websocket support.

close

(close socket)(close socket code reason)
Closes the websocket, with an optional custom integer status code and reason
string.

open?

(open? socket)
Returns true if the Socket is open, false otherwise.

ping

(ping socket)(ping socket data)
Sends a ping message via a websocket, with an optional byte array or
ByteBuffer that may contain custom session data. A convenient wrapper for the
-ping protocol method.

pong

(pong socket)(pong socket data)
Sends an unsolicited pong message via a websocket, with an optional byte
array or ByteBuffer that may contain custom session data. A convenient wrapper
for the -pong protocol method.

request-protocols

(request-protocols request)
Returns a collection of websocket subprotocols from a request map.

send

(send socket message)(send socket message succeed fail)
Sends text or binary data via a websocket, either synchronously or
asynchronously with callback functions. A convenient wrapper for the -send and
-send-async protocol methods.

upgrade-request?

(upgrade-request? request)
Returns true if the request map is a websocket upgrade request.

websocket-response?

(websocket-response? response)
Returns true if the response contains a websocket listener.