Skip to content

Instantly share code, notes, and snippets.

@thattommyhall
Last active April 3, 2020 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thattommyhall/1bda32d40bcfc9b15a14b2029b8d7dc2 to your computer and use it in GitHub Desktop.
Save thattommyhall/1bda32d40bcfc9b15a14b2029b8d7dc2 to your computer and use it in GitHub Desktop.
(ns crossbar-clj.core
(:require [promissum.core :as p])
(:import [io.crossbar.autobahn.wamp Session Client]))
(defn -main []
(let [wampSession (new Session)
wampClient (new Client
wampSession
"ws://localhost:8080/ws"
"realm1"
)]
#_(.addOnJoinListener wampSession
(fn [session, details]
(let [callFuture (.call session "my.com.date")
]
(.whenComplete callFuture (fn [date, throwable]
(println date))))))
(.connect wampClient)
(Thread/sleep 1000)
(println (first (.results (p/await (.call wampSession "my.com.date")))))
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment