   ([client channel message]
     (publish *cometd* client channel message))
   ([servlet client channel message]
-    (.publish (get-channel servlet channel) client message nil)))
+    (.publish (get-channel servlet channel)
+              client
+              (json-generator message)
+              nil)))
 
 (defn subscribe
   "Subscribe to a channel."

  (.. servlet (getBayeux)
              (getChannel channel true)))

(defn publish
  "Publish a message to a channel."
  ([channel message]

            (func mesg))))
      (.subscribe (get-channel servlet channel) client))))

;;;; Security ;;;;

(comment
(defn allowed-to?)

(defn create-security-policy
  "Create a extensible security policy for an existing cometd servlet."
  [servlet]
  (.. servlet
      (getBayeux)
      (setSecurityPolicy
        (proxy SecurityPolicy
          (canPublish [])))))

(defn deny-subscribe
  "Deny subscription requests matching a predicate."
  [pred])
  

(defn deny-publish
  [pred])

)
