(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 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.
(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.
(start-ws-connection-with-fc-support on-connect-fn send-buffer-or-n)
start-ws-connection but transmission is non-blocking and supports conveying transmission results. This allows services to implement flow control.
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 is the message to be sent and
resp-ch is the channel in which the transmission result will be put.
(ws-send msg remote-endpoint)
remote-endpoint. May block.
(ws-send-async msg remote-endpoint)
remote-endpoint. Returns a promise channel from which the result can be taken.
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).