Hi, I'm trying to write an xmpp, which after receiving a message, pushes the messages with a websocket using async-push. I can't figure out how to do this because both xmpp and async-push use event handlers -- how do I chain them together. This code doesn't work, but I guess you get the idea of what I'm going for. Thanks in advance for any help!
(ns ws-rand.core (:use aleph.http noir.core lamina.core) (:require [noir-async.core :as na] [noir-async.utils :as na-util] [noir.server :as nr-server] [xmpp-clj :as xmpp])) (defn handle-message [message] (let [body (:body message) from-user (:from-name message)] ; WRONG I don't know how to embed async-push inside of the handler..... (na/defpage-async "/rand" {} conn #(na/async-push conn body) ))) (defn -main [& m] (let [mode (keyword (or (first m) :dev)) port (Integer. (get (System/getenv) "PORT" "3000")) noir-handler (nr-server/gen-handler {:mode mode})] (xmpp/start-bot :username "pre...@jabber.org" :password "password" :host "jabber.org" :domain "jabber.org" :handler (var handle-message)) (start-http-server (wrap-ring-handler noir-handler) {:port port :websocket true}))) -- 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