ring-middleware-format
ring-middleware-format copied to clipboard
Compatibility with Immutant websocket middleware
https://github.com/immutant/immutant/blob/2.0.0-beta1/web/src/immutant/web/websocket.clj#L72
In Immutant websocket connection can be initialized from middleware or from standard ring handler. In former case it's possible to reorder middlewares so that r-m-f doesn't see the response from websocket middleware.
Another solution is to provide custom predicate to wrap-restful-response:
(defn serializable?
[{:keys [websocket?] :as request} {:keys [body] :as response}]
(when response
(not (or
websocket?
(string? body)
(instance? File body)
(instance? InputStream body)))))