portal

gdubs 2023-07-25T04:17:08.342089Z

How do I start/open the vs-code hosted portal so I can hit it from a shadow-cljs browser environment?

djblue 2023-07-25T18:04:09.108909Z

Hitting the /submit is equivalent to calling portal.api/submit

djblue 2023-07-25T18:28:14.672869Z

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

gdubs 2023-07-25T18:29:54.122669Z

> 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?

djblue 2023-07-25T18:30:54.718889Z

Yeah, you can call portal.api/open on the jvm which shadow-cljs is running 👍

djblue 2023-07-25T18:31:12.800929Z

And you can pass all the normal options to open, like {:launcher :vs-code}

gdubs 2023-07-25T18:45:31.938099Z

Cool. Do I need to pass it special options so it associates with the already-started server and doesn't start a new server?

djblue 2023-07-25T18:48:23.288529Z

Nope, the server will only start if not already started

👍 1
gdubs 2023-07-25T18:49:38.728359Z

Is that only true of the JVM that runs shadow is the same JVM that I use to call portal.api/open?

👍 1
djblue 2023-07-25T18:51:01.443039Z

Yup, although you can submit to another jvm which has portal as long as you coordinate which port to use for /submit

djblue 2023-07-25T18:51:32.762569Z

You can start/open portal with a hard coded port to make that coordination a little easier

gdubs 2023-07-25T18:52:51.892169Z

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.

👍 1
gdubs 2023-07-25T04:17:34.722439Z

I imagine I could call portal.api/open from a joyride script?

gdubs 2023-07-25T04:23:04.148769Z

Similar question except I'm using browser instead of node: https://clojurians.slack.com/archives/C0185BFLLSE/p1661026662799939

gdubs 2023-07-25T05:08:33.168459Z

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?