This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-07-26
Channels
- # bangalore-clj (1)
- # beginners (12)
- # boot (48)
- # cider (56)
- # clara (1)
- # cljs-dev (15)
- # clojure (455)
- # clojure-austin (2)
- # clojure-dev (33)
- # clojure-italy (26)
- # clojure-nl (6)
- # clojure-poland (10)
- # clojure-russia (23)
- # clojure-spec (33)
- # clojure-uk (62)
- # clojurescript (37)
- # code-art (2)
- # cursive (12)
- # datomic (48)
- # funcool (1)
- # juxt (16)
- # leiningen (13)
- # off-topic (12)
- # om (23)
- # onyx (16)
- # other-lisps (5)
- # parinfer (2)
- # pedestal (28)
- # re-frame (60)
- # reagent (8)
- # ring (1)
- # ring-swagger (15)
- # spacemacs (5)
- # specter (53)
- # test-check (2)
- # unrepl (8)
- # vim (14)
@lxsameer You can implement a custom WebSocketListener to get the context in ws callback
@lxsameer Pedestal exposes a router through an interceptor, which has different properties as compared to a middleware fn. There are a number of router implementations in the Pedestal code base and they all implement the Router
protocol (https://github.com/pedestal/pedestal/blob/master/route/src/io/pedestal/http/route/router.clj#L15). However, the router implementations have certain expectations. Firstly, they take a collection of expanded routes. Secondly, find-route
is executed against a request map that has, at minimum, a :path-info
and :request-method
key. I don’t think :path-info
is a standard ring request key.
The result of find-route
is the matched route. It’s the responsibility of the caller to then execute the interceptor chain associated with it.
Pedestal’s router interceptor impl actually enqueues the interceptors from the matched route
Given that, it may be possible to leverage a router implementation directly for it’s route matching capabilities
but you would still need to do some request map xform to create the add the :path-info
key
Here’s a snipped which captures the minimum requirements for route matching. I posted this sometime ago in response to a route testing inquiry https://gist.github.com/ddeaguiar/bed92b8f34b7e93f15cd0e5548d783ae#file-route_testing-clj-L30.
I prefer Pedestal’s interceptor semantics over traditional middleware and found it fairly easy to port exiting middleware to interceptors
I’ve also found that I’ve been able to use libraries in Pedestal that were built with ring in mind. Take Liberator as an example
@ddeaguiar thanks
But I wouldn’t recommend mixing interceptors and middleware in an app because it would detract from the conceptual integrity of the system
@ddeaguiar I think Pedestal is really cool, but there are several problems which really bother me
for example websocket support is really awful at the moment, I ended up writing lots of enhancement to make it work as i want
I definitely recommend raising them and it would be best to do so in the Pedestal user group as commentary there is durable
Yes, documentation can definitely be improved and is something that I’ve been trying to help with. It’s just a bandwidth issue
I’ve not done much with the websocket implementation to develop an opinion just yet.
@lxsameer, out of curiosity, do you have a websocket implementation you prefer which you can provide for comparison purposes?
@ddeaguiar Immutant and jetty supports websocket but to be honest those are just some implementation which are low level . But as a cool tool I suggest Sente
which is more like a higher level tool and