Using WebSocket with Pedestal and Jetty

Pedestal provides out-of-the-box support for Jetty WebSockets as a part of its pedestal.jetty module. To create and register a WebSocket endpoint, Pedestal provides the add-ws-endpoints function that accepts a ServletContextHandler and a Map of WebSocket paths to the action Map. Based on the provided WebSocket paths, it produces the corresponding servlets and adds them to the context of the servlet container, that is, Jetty in this case. The servlet container then makes the WebSocket paths available for the clients to connect to using the WebSocket protocol. The WebSocket endpoints are communicated to the Jetty container using the :context-configurator key of the map assigned to the ::http/container-options ...

Get Microservices with Clojure now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.