🐛 Fix unexpected exception on websocket handler.

This commit is contained in:
Andrey Antukh 2020-01-28 12:52:48 +01:00
parent 590b68aa29
commit 2f589a49e9

View file

@ -17,6 +17,7 @@
[uxbox.util.uuid :as uuid] [uxbox.util.uuid :as uuid]
[uxbox.util.transit :as t] [uxbox.util.transit :as t]
[uxbox.util.blob :as blob] [uxbox.util.blob :as blob]
[vertx.core :as vc]
[vertx.http :as vh] [vertx.http :as vh]
[vertx.web :as vw] [vertx.web :as vw]
[vertx.util :as vu] [vertx.util :as vu]
@ -87,12 +88,12 @@
(defn handler (defn handler
[{:keys [user] :as req}] [{:keys [user] :as req}]
(letfn [(on-init [ws] (letfn [(on-init [ws]
(let [vsm (::vw/execution-context req) (let [ctx (vc/current-context)
fid (get-in req [:path-params :file-id]) fid (get-in req [:path-params :file-id])
ws (assoc ws ws (assoc ws
:user-id user :user-id user
:file-id fid) :file-id fid)
sem (start-eventbus-consumer! vsm ws fid)] sem (start-eventbus-consumer! ctx ws fid)]
(handle-message ws {:type :connect}) (handle-message ws {:type :connect})
(assoc ws ::sem sem))) (assoc ws ::sem sem)))