How do I start/open the vs-code hosted portal so I can hit it from a shadow-cljs browser environment?
Hitting the /submit is equivalent to calling portal.api/submit
https://github.com/djblue/portal/blob/master/src/portal/runtime/jvm/server.clj#L175-L179
Which gets conj'd into this private list https://github.com/djblue/portal/blob/master/src/portal/runtime.cljc#L198-L200 which is the default value portal will inspect
> But when I submit data to the server, where does it go?
Sorry, I should've been clearer. I recognize that it goes to to the running server, but how do I view it? Can I 'open' a portal that also attaches to the same server that shadow-cljs started?
Yeah, you can call portal.api/open on the jvm which shadow-cljs is running 👍
And you can pass all the normal options to open, like {:launcher :vs-code}
Cool. Do I need to pass it special options so it associates with the already-started server and doesn't start a new server?
Nope, the server will only start if not already started
Is that only true of the JVM that runs shadow is the same JVM that I use to call portal.api/open?
Yup, although you can submit to another jvm which has portal as long as you coordinate which port to use for /submit
You can start/open portal with a hard coded port to make that coordination a little easier
Cool. Last night I started down the path of modifying the shadow hook to use open instead of start, that way it automatically opens a portal when I run shadow-cljs watch. Shouldn't be too hard to manage.
I imagine I could call portal.api/open from a joyride script?
Similar question except I'm using browser instead of node: https://clojurians.slack.com/archives/C0185BFLLSE/p1661026662799939
This was helpful: https://github.com/djblue/portal/blob/098062b5ae23bbdb027654b887f874c0eb7cce88/doc/remote-api.md#usage
Ran across https://github.com/djblue/portal/blob/098062b5ae23bbdb027654b887f874c0eb7cce88/src/portal/shadow/remote.clj which starts a server. Pretty neat. But when I submit data to the server, where does it go?