From 1d34a270e36797074e2c8b064877d32408a7e602 Mon Sep 17 00:00:00 2001 From: Jim Crossley Date: Fri, 16 Jan 2015 16:14:12 -0500 Subject: [PATCH] Verify wrap-websocket is truly MIDDLEware now, either in or out-of-container --- web/dev-resources/testing/app.clj | 4 ++-- web/src/immutant/web/middleware.clj | 14 +++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/web/dev-resources/testing/app.clj b/web/dev-resources/testing/app.clj index 6059af52..193d0f31 100644 --- a/web/dev-resources/testing/app.clj +++ b/web/dev-resources/testing/app.clj @@ -102,8 +102,8 @@ (defn run [] (web/run (-> #'routes - wrap-session (wrap-websocket :on-open #'on-open-set-handshake - :on-message #'on-message-send-handshake))) + :on-message #'on-message-send-handshake) + wrap-session)) (web/run (-> ws-as-channel wrap-session) :path "/ws")) diff --git a/web/src/immutant/web/middleware.clj b/web/src/immutant/web/middleware.clj index 8eb636be..58b35c68 100644 --- a/web/src/immutant/web/middleware.clj +++ b/web/src/immutant/web/middleware.clj @@ -82,15 +82,11 @@ * :on-error `(fn [channel throwable])` If handler is nil, a 404 status will be returned for any - non-websocket request. - - If called within a servlet container, e.g. WildFly, this should be - the last call in your middleware chain, as its result will be a - servlet, not a function." + non-websocket request." ([handler key value & key-values] - (wrap-websocket handler (apply hash-map key value key-values))) + (wrap-websocket handler (apply hash-map key value key-values))) ([handler callbacks] (fn [request] - (if (:websocket? request) - (as-channel request callbacks) - (merge {:status 404} (when handler (handler request))))))) + (if (:websocket? request) + (as-channel request callbacks) + (merge {:status 404} (when handler (handler request)))))))