Liking cljdoc? Tell your friends :D

Remote API

If running the Portal runtime in process is not supported or not desired, values can be sent over the wire to a remote instance.

The following clients are currently implemented:

  • portal.client.jvm
  • portal.client.node
  • portal.client.web
    • cljs running in the browser
  • portal.client.planck

Usage

In the process hosting the remote api, do:

(require '[portal.api :as p])
(p/open {:port 5678})

In the client process, do:

(require '[portal.client.jvm :as p])
;; (require '[portal.client.node :as p])
;; (require '[portal.client.web :as p])

(def submit (partial p/submit {:port 5678})) ;; :encoding :edn is the default
;; (def submit (partial p/submit {:port 5678 :encoding :json}))
;; (def submit (partial p/submit {:port 5678 :encoding :transit}))

(add-tap #'submit)

NOTE: tap>'d values must be serializable as edn, transit or json.

Tips

Platform specific tips.

Planck

Since Planck can load libraries from a jar, you can use the clj tool to generate the class path and pass it in via the --classpath cli argument.

To start a Planck with Portal REPL, do:

clj -Spath -Sdeps '{:deps {djblue/portal {:mvn/version "LATEST"}}}' > .classpath
planck -c `cat .classpath`

Then at the REPL, do:

(require '[portal.client.planck :as p])
(def submit (partial p/submit {:port 5678}))
(add-tap #'submit)
(tap> :hello-from-planck)

nbb

For nbb, currently it can only consume file system based libraries so Portal needs to be fetched from source via git.

To start a nbb with Portal REPL, do:

clj -Sdeps '{:deps {djblue/portal {:git/url "https://github.com/djblue/portal" :git/sha "1009dd87a8975eca0d3724cd8bf957ac94712b6a"}}}' -Spath > .classpath
nbb --classpath `cat .classpath`

Then at the REPL, do:

(require '[portal.client.node :as p])
(def submit (partial p/submit {:port 5678}))
(add-tap #'submit)
(tap> :hello-from-nbb)

Can you improve this documentation?Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close