On 03/05/2016 10:18 PM, Nasko wrote: > I am trying to implement a simple asynchronous chat service using Aleph > and Lamina. However, it looks like the enqueue function coming from > lamina cannot be implemented and causes an exception. This is what my > chat function looks like: > | > (defn chat [ch request] > "View handler that handles a chat room. If it's not > a websocket request then return a rendered html response." > (let [params(:route-paramsrequest) > room (:room params)] > (if(:websocket request) > (chat-handler ch room) > (enqueue ch (wrapped-sync-app request))))) > | > I don't understand why the value of (wrapped-sync-app request) is nil. > Any feedback would be helpful.
Hard to say, since you don't give a definition for the wrapped-sync-app function. Some google and it shows up in a few example apps as some kind of ring handler. If you are using compojure (maybe other routing libraries) returning nil is what it does by default if no routes match a give request (as a result of how it determines if a route matches). But looking at your subject line, given that error it is likely 'ch' is nil, not the result of calling wrapped-sync-app. I would sprinkle printlns liberally throughout. As an aside, your docstring (if you intend it to be a docstring) is in the wrong place. Docstrings go before the argument vector if you want them to be accessible via 'doc' in the repl. https://github.com/jonase/eastwood has a linter that catches this kind of thing. > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to clojure+unsubscr...@googlegroups.com > <mailto:clojure+unsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout. -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.