This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-12-06
Channels
- # adventofcode (112)
- # announcements (6)
- # beginners (197)
- # boot (3)
- # calva (52)
- # cider (25)
- # clara (14)
- # cljdoc (6)
- # clojure (147)
- # clojure-austin (6)
- # clojure-berlin (7)
- # clojure-brasil (2)
- # clojure-europe (3)
- # clojure-india (4)
- # clojure-italy (8)
- # clojure-new-zealand (2)
- # clojure-nl (7)
- # clojure-russia (7)
- # clojure-spec (29)
- # clojure-uk (63)
- # clojurescript (103)
- # core-async (5)
- # cursive (11)
- # datomic (16)
- # devcards (1)
- # emacs (28)
- # figwheel-main (3)
- # fulcro (97)
- # graphql (4)
- # hyperfiddle (1)
- # jobs (1)
- # kaocha (3)
- # lumo (9)
- # nrepl (4)
- # off-topic (29)
- # onyx (1)
- # pathom (4)
- # pedestal (8)
- # re-frame (24)
- # reagent (1)
- # reitit (13)
- # ring-swagger (7)
- # rum (11)
- # shadow-cljs (79)
- # sql (46)
- # tools-deps (67)
- # yada (8)
Hello, I’m using compojure-api version “2.0.0-alpha28”, trying to set up an async handler.
(context "/test" []
:tags ["Testing"]
(GET "/" []
:summary "testing"
(async/go
(async/<! (async/timeout 500))
(ok {:message "Hello"}))))
When i try to hit the endpoint, I get:
ERROR compojure.api.exception: No implementation of method: :render of protocol: #'compojure.response/Renderable found for class: clojure.core.async.impl.channels.ManyToManyChannel
I’ve noticed that in https://github.com/metosin/compojure-api/tree/master/examples/async the project.clj
contains
:ring {:handler example.handler/app
:async? true}
but from what I understand, that’s only relevant when running with lein, which I’m not doing. Any thoughts?@jon324 hi. the async requires the server to be run in ring-async mode: the server should call the application with 3 arguments, described in here: https://www.booleanknot.com/blog/2016/07/15/asynchronous-ring.html
Jetty support ring-async oob, with Aleph, Immutant or http-kit, you need to write 1+ lines of boilerplate to do this.
I’m trying to see if I can do something similar with Jetty by following this blog post: https://www.lucagrulla.com/posts/server-sent-events-with-ring-and-compojure/
On this line (fn [req res raise]
I get
ERROR compojure.api.exception: Wrong number of args (1) passed to: services/fn--41918/fn--41919
clojure.lang.ArityException: Wrong number of args (1) passed to: services/fn--41918/fn--41919
at clojure.lang.AFn.throwArity(AFn.java:429)
at clojure.lang.AFn.invoke(AFn.java:32)
at compojure.response$eval18314$fn__18315.invoke(response.clj:47)
at compojure.response$eval18236$fn__18237$G__18227__18244.invoke(response.clj:7)
at compojure.core$wrap_response$fn__20191.invoke(core.clj:158)
at compojure.core$wrap_route_middleware$fn__20175.invoke(core.clj:128)
at compojure.core$wrap_route_info$fn__20180.invoke(core.clj:137)
at compojure.core$wrap_route_matches$fn__20184.invoke(core.clj:146)
at compojure.api.routes.Route.invoke(routes.clj:90)
at compojure.core$routing$fn__20199.invoke(core.clj:185)