pedestal

ikitommi 2019-05-14T05:37:50.096300Z

I would say Pedestal is a framework, as it calls your code 😉 There is also reitit-pedestal add-on, which allows one to describe header-params with spec. With request-coercion interceptor mounted, validation, coercion (string->edn) and api-docs are pulled from those definitions. Would be something like:

["/headers"
 {:get {:summary "playing with header-params"
        :parameters {:header {:x-int pos-int?}}
        :interceptors [(coercion/coerce-request-interceptor)]
        :handler (fn [req]
                   {:status 200
                    :body {:value (-> req :parameters :header :x-int inc)}})}}]

ikitommi 2019-05-14T05:40:09.096500Z

jackson 2019-05-14T18:44:13.099Z

question about web sockets.. Is there a simple way to know which client closed their end so that I can remove them from my collection of clients? I've done some workarounds requiring the client to have an id as a query param and I can look them up by request on close, but I was hoping there was something simpler that I've been overlooking.

jackson 2019-05-14T19:41:30.099700Z

update, keying off the hash of the request seems to work well enough without requiring the client to provide an id.