Skip to content

Commit

Permalink
fixup! [mod] [taoensso#424] reintroduce fixed jetty9-ring-adapter s…
Browse files Browse the repository at this point in the history
…upport
  • Loading branch information
TimoKramer committed Mar 21, 2023
1 parent fd6a1cc commit 05013dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
5 changes: 1 addition & 4 deletions example-project/src/example/server.clj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
;; [taoensso.sente.server-adapters.aleph :refer [get-sch-adapter]]

[ring.adapter.jetty9 :as jetty]
[ring.adapter.jetty9.websocket :as jetty9.websocket]
[taoensso.sente.server-adapters.jetty9 :refer [get-sch-adapter]]
;;
;; See https://gist.github.com/wavejumper/40c4cbb21d67e4415e20685710b68ea0
Expand Down Expand Up @@ -147,9 +146,7 @@
You're also STRONGLY recommended to use `ring.middleware.anti-forgery`
or something similar."
(ring.middleware.defaults/wrap-defaults
ring-routes (-> ring.middleware.defaults/site-defaults
(assoc-in [:params :multipart] false)
(dissoc :security))))
ring-routes ring.middleware.defaults/site-defaults))

;;;; Some server>user async push examples

Expand Down
12 changes: 6 additions & 6 deletions src/taoensso/sente/server_adapters/community/jetty9.clj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
[2] https://github.com/sunng87/ring-jetty9-adapter/issues/41#issuecomment-630206233
[3] https://gist.github.com/wavejumper/40c4cbb21d67e4415e20685710b68ea0"

{:author "Thomas Crowley (@wavejumper)"}
{:author "Thomas Crowley (@wavejumper), modified for async jetty by Timo Kramer"}
(:require [clojure.string :as str]
[ring.adapter.jetty9.websocket :as jetty9.websocket]
[taoensso.sente.interfaces :as i]))
Expand All @@ -34,11 +34,11 @@

(defn- server-ch-resp
[websocket? {:keys [on-open on-close on-msg on-error ring-async-resp-fn ring-async-raise-fn]}]
{:on-connect (fn [sch ] (on-open sch websocket?))
:on-text (fn [sch msg ] (on-msg sch websocket? msg))
:on-error (fn [sch error ] (on-error sch websocket? error))
:on-close (fn [sch status _] (on-close sch websocket? status))
:ring-async-resp-fn ring-async-resp-fn
{:on-connect (fn [sch ] (on-open sch websocket?))
:on-text (fn [sch msg ] (on-msg sch websocket? msg))
:on-error (fn [sch error ] (on-error sch websocket? error))
:on-close (fn [sch status _] (on-close sch websocket? status))
:ring-async-resp-fn ring-async-resp-fn
:ring-async-raise-fn ring-async-raise-fn})

(deftype JettyServerChanAdapter []
Expand Down

0 comments on commit 05013dd

Please sign in to comment.