{"action":"opened","issue":{"url":"https://api.github.com/repos/ngrunwald/ring-middleware-format/issues/46","labels_url":"https://api.github.com/repos/ngrunwald/ring-middleware-format/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/ngrunwald/ring-middleware-format/issues/46/comments","events_url":"https://api.github.com/repos/ngrunwald/ring-middleware-format/issues/46/events","html_url":"https://github.com/ngrunwald/ring-middleware-format/issues/46","id":104300489,"number":46,"title":"Compatibility with Immutant websocket middleware","user":{"login":"Deraen","id":648087,"avatar_url":"https://avatars.githubusercontent.com/u/648087?v=3","gravatar_id":"","url":"https://api.github.com/users/Deraen","html_url":"https://github.com/Deraen","followers_url":"https://api.github.com/users/Deraen/followers","following_url":"https://api.github.com/users/Deraen/following{/other_user}","gists_url":"https://api.github.com/users/Deraen/gists{/gist_id}","starred_url":"https://api.github.com/users/Deraen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Deraen/subscriptions","organizations_url":"https://api.github.com/users/Deraen/orgs","repos_url":"https://api.github.com/users/Deraen/repos","events_url":"https://api.github.com/users/Deraen/events{/privacy}","received_events_url":"https://api.github.com/users/Deraen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-01T16:07:47Z","updated_at":"2015-09-01T16:07:47Z","closed_at":null,"body":"https://github.com/immutant/immutant/blob/2.0.0-beta1/web/src/immutant/web/websocket.clj#L72\r\n\r\nIn 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.\r\n\r\nAnother solution is to provide custom predicate to `wrap-restful-response`:\r\n\r\n```\r\n(defn ^:no-doc serializable?\r\n  [{:keys [websocket?] :as request} {:keys [body] :as response}]\r\n  (when response\r\n    (not (or\r\n          websocket?\r\n          (string? body)\r\n          (instance? File body)\r\n          (instance? InputStream body)))))\r\n```"}}