nbb

Chris McCormick 2024-09-25T14:07:57.474519Z

I'm trying to figure out how hard it would be to create an nbb/nodejs version of this: https://github.com/babashka/sci.nrepl/blob/main/src/sci/nrepl/browser_server.clj Basically I want to be able to access the scittle nREPL but via a running nbb server. It's a bit out of my depth but I might take a shot. Is the basic thing this does just forwarding from the editor client to the scittle websocket?

m3tti 2024-09-25T14:20:04.656679Z

Isn't sci part of nbb. Afaik yes so you could generally do exactly the same right? Just with node utils like express and such.

Chris McCormick 2024-09-25T14:20:54.700509Z

Yes exactly, I hope so.

m3tti 2024-09-25T14:21:53.731489Z

So i would spin up nbb add express or hapi or whatsoever and copy paste the s**t out of the example you shared xD

👍 1
m3tti 2024-09-25T14:24:06.328649Z

Ok i guess you'll need http://socket.io

Chris McCormick 2024-09-25T14:24:46.044179Z

I think it's pretty simple to implement a websocket server in raw express.

m3tti 2024-09-25T14:24:55.608509Z

Due to the fact the example uses a websocket. No clue if there is plain nodejs solution

m3tti 2024-09-25T14:27:47.998099Z

A quick search told me this :/ https://masteringjs.io/tutorials/express/websockets which refers to use ws for that there is even express-ws

🙏 1
🎉 1
borkdude 2024-09-25T14:49:45.330189Z

access the scittle nREPL but via a running nbb serverWhy don't you write an nREPL client in nbb then?

borkdude 2024-09-25T14:50:26.371709Z

the websocket thing just exists because of browser limitations

Chris McCormick 2024-09-25T20:12:48.789019Z

Going off what I am reading here: https://github.com/babashka/scittle/tree/main/doc/nrepl I want to hook into Scittle from my editor, but that has to go via a websocket server, is that correct? The browser can't connect directly to my editor I guess. On that page it says to use babashka or Clojure JVM as the intermediary but I wanted a pure JS runtime solution. So I was thinking I want to run sci.nrepl on top of nbb. Does that sound right?

Chris McCormick 2024-09-25T20:16:27.397919Z

Actually this is probably not going to work I think because fireplace.vim expects a JVM nREPL before it will piggieback into the ClojureScript one. I'll do some more testing.

borkdude 2024-09-25T20:19:58.068839Z

> I want to hook into Scittle from my editor, but that has to go via a websocket server, is that correct? Yes, you need to run a websocket server, but this is an implementation detail. Your editor should connect to the nREPL server, that proxies to that websocket server. The websocket server is an implementation detail

borkdude 2024-09-25T20:20:06.160799Z

I don't see how this relates to nbb

borkdude 2024-09-25T20:21:12.890489Z

Try Calva and connect with the "nbb" type nREPL. This should work. Or try lein repl :connect <port> . Should also work. If vim doesn't work, you could try conjure

borkdude 2024-09-25T20:21:37.420319Z

or ping the author to support arbitrary nREPL servers instead of hardcoding JVM stuff into it

borkdude 2024-09-25T20:22:38.372169Z

or was nbb going to be your workaround for the fireplace issue?

borkdude 2024-09-25T20:23:04.288899Z

if you can have an nbb nrepl session in fireplace, then scittle would likely also work

Chris McCormick 2024-09-27T19:46:00.864739Z

Whoops sorry for dropping the ball on this thread, I got really busy! Thanks for your replies above I will have another shot at getting this working and report back.