Fork me on GitHub
#pedestal
<
2016-01-26
>
xlevus14:01:39

Is anybody able to explain

(defroutes route-table
  [[["/events" {:get [::events (start-event-stream stream-ready)]}]]])
in : https://github.com/pedestal/pedestal/blob/master/guides/documentation/service-sse.md Does ::events need to be implemented? or is it just an arbitrary symbol?

jonahbenton14:01:31

hey @xlevus. the short answer is that it's an optional part of the routing data structure. see https://github.com/pedestal/pedestal/blob/master/guides/documentation/service-routing.md#verb-maps. ::events is an optional name for that particular route, and see https://github.com/pedestal/pedestal/blob/master/guides/documentation/service-routing.md#route-names for more about route naming.

xlevus14:01:18

I keep getting Exception in thread "async-thread-macro-1" java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Locale whenever I do anything in the function passed to start-event-stream. But when I make the body of the function just nil it seems to work fine, and my browser appears to open the EventStream connection fine.

xlevus15:01:07

oh. nope. only happens with timbre. ok.

xlevus15:01:27

yeah, mostly. Can't seem to call Timbre logging functions within anything that's async. but might be another issue altogether

jplaza16:01:28

Cool thanks @frankie ! I’m still trying to understand why isn’t this something that comes as part of the library. Or someone builds something on top of pedestal. This is a pretty common use case when developing web apps