Liking cljdoc? Tell your friends :D

io.pedestal.http.jetty.websockets


add-ws-endpointsclj

(add-ws-endpoints ctx ws-paths)
(add-ws-endpoints ctx ws-paths opts)

Given a ServletContextHandler and a map of WebSocket (String) paths to action maps, produce corresponding Servlets per path and add them to the context. Return the context when complete.

You may optionally also pass in a map of options. Currently supported options: :listener-fn - A function of 3 args, the ServletUpgradeRequest, ServletUpgradeResponse, and the WS-Map that returns a WebSocketListener.

Given a ServletContextHandler and a map of WebSocket (String) paths to action maps,
produce corresponding Servlets per path and add them to the context.
Return the context when complete.

You may optionally also pass in a map of options.
Currently supported options:
 :listener-fn - A function of 3 args,
                the ServletUpgradeRequest, ServletUpgradeResponse, and the WS-Map
                that returns a WebSocketListener.
raw docstring

make-ws-listenerclj

(make-ws-listener ws-map)

Given a map representing WebSocket actions (:on-connect, :on-close, :on-error, :on-text, :on-binary), return a WebSocketConnectionListener. Values for the map are functions with the same arity as the interface.

Given a map representing WebSocket actions
(:on-connect, :on-close, :on-error, :on-text, :on-binary),
return a WebSocketConnectionListener.
Values for the map are functions with the same arity as the interface.
raw docstring

start-ws-connectionclj

(start-ws-connection on-connect-fn)
(start-ws-connection on-connect-fn send-buffer-or-n)

Given a function of two arguments (the Jetty WebSocket Session and its paired core.async 'send' channel), and optionall a buffer-or-n for the 'send' channel, return a function that can be used as an OnConnect handler.

Notes:

  • You can control the entire WebSocket Session per client with the session object.
  • If you close the send channel, Pedestal will close the WS connection.
Given a function of two arguments
(the Jetty WebSocket Session and its paired core.async 'send' channel),
and optionall a buffer-or-n for the 'send' channel,
return a function that can be used as an OnConnect handler.

Notes:
 - You can control the entire WebSocket Session per client with the
session object.
 - If you close the `send` channel, Pedestal will close the WS connection.
raw docstring

start-ws-connection-with-fc-supportclj

(start-ws-connection-with-fc-support on-connect-fn)
(start-ws-connection-with-fc-support on-connect-fn send-buffer-or-n)

Like start-ws-connection but transmission is non-blocking and supports conveying transmission results. This allows services to implement flow control.

Notes:

Putting a sequential value on the send channel signals that a transmission response is desired. In this case the value is expected to be a 2-tuple of [msg resp-ch] where msg is the message to be sent and resp-ch is the channel in which the transmission result will be put.

Like `start-ws-connection` but transmission is non-blocking and supports
conveying transmission results. This allows services to implement flow
control.

Notes:

Putting a sequential value on the `send` channel signals that a
transmission response is desired. In this case the value is expected to
be a 2-tuple of [`msg` `resp-ch`] where `msg` is the message to be sent
and `resp-ch` is the channel in which the transmission result will be
put.
raw docstring

WebSocketSendcljprotocol

ws-sendclj

(ws-send msg remote-endpoint)

Sends msg to remote-endpoint. May block.

Sends `msg` to `remote-endpoint`. May block.

WebSocketSendAsynccljprotocol

ws-send-asyncclj

(ws-send-async msg remote-endpoint)

Sends msg to remote-endpoint. Returns a promise channel from which the result can be taken.

Sends `msg` to `remote-endpoint`. Returns a
promise channel from which the result can be taken.

ws-servletclj

(ws-servlet creation-fn)

Given a function (that takes a ServletUpgradeRequest and ServletUpgradeResponse and returns a WebSocketListener), return a WebSocketServlet that uses the function to create new WebSockets (via a factory).

Given a function
(that takes a ServletUpgradeRequest and ServletUpgradeResponse and returns a WebSocketListener),
return a WebSocketServlet that uses the function to create new WebSockets (via a factory).
raw docstring

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

× close