(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.
(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.
(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:
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.
(ws-send msg remote-endpoint)
(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).
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close