-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client-side projects #47
Comments
OK, this thread explains that the problem lies with the Clojurescript repl itself, so not an Austin issue. http://comments.gmane.org/gmane.comp.java.clojure.user/60605 So what's LightTable secret sauce and how can Austin benefit from it? Contrary to the official Clojurescript stance that it is not supported, LightTable enables the use case where a html file is opened from disk and successfully establishes a connection with a Clojurescript repl. |
Preliminary findings indicate that LightTable fires up an internal web server with websockets transport. Very interesting. Is this outside the scope of Austin? If so, I'll close this issue. Thanks. BTW, there is a reward for implementing this: https://twitter.com/swannodette/status/365272360896569344 :-) |
Either way, there's a server, something needs to be available to compile the ClojureScript you're evaluating, etc. Given that, what's the benefit of a websocket server vs. HTTP? Note that Austin just reuses the stock ClojureScript browser-REPL client-side bits, which uses a CrossPageChannel to talk to the server. Changing that isn't necessarily outside of Austin's scope, but (a) it's not a nontrivial change, and (b) the work would necessitate a compelling benefit. |
I agee, it doesn't need to be websocket per se. In this particular instance, I care about the use case, which could be defined like this: "given a client-side project with no server component, start an in-browser Clojurescript repl." When I was doing the Om tutorial (https://github.com/swannodette/om/wiki/Basic-Tutorial) which contains instructions for LightTable, I was shocked to see how easy it was. Austin should probably continue to use the stock ClojureScript browser-REPL as-is, but it could provide the additional tooling LightTable has. Whatever the implementation details are, with or without websockets. It's all public, open source code anyway. |
There are a couple of things:
I've long wanted Austin to have its own browser-side component to replace |
That all makes a lot of sense. And it sounds like a good plan. |
An easier approach would be to allow the user to "mount" a local directory as the root of all resources served for a particular REPL session (mock usage here): user=> (cemerick.austin.repls/mount-static "/app/directory" ...other REPL env config)
Static local site mounted @ http://localhost:51665/3889/ So This would be a much less significant change, but achieve the same objectives…while preserving the ability to have multiple concurrent browser-REPL sessions. Patch welcome. |
I agree. I discovered that somebody already proposed something along those lines. https://github.com/aamedina/cljs/blob/master/src/leiningen/new/om_cljs/dev/user.clj I tried it myself and it works great. Austin could borrow from it, no? |
Yes, it looks like the approach I described is exactly what was implemented there. So, "borrow", yes, conceptually. The user in question hasn't submitted a PR themselves, so any kind of copy/paste wouldn't be appropriate; but even so, they are operating a separate server that happens to coordinate with a running Austin REPL environment to get the necessary connect URL, etc. The "mounting" of a directory as the root of an Austin session's served content can and should be part of |
Client-side projects don't necessarily have a server component (and shouldn't be required to have one).
Take for example the basic tutorial for om: https://github.com/swannodette/om/wiki/Basic-Tutorial
That tutorial has instructions for starting a Clojurescript repl in LightTable.
"Type the key chord Control-SPACE to open up the command list. Start typing Add Connection, press enter to select it. In the list of options select Browser (External). Copy and paste the script tag into index.html before the div tag."
And that's all there is to it.
I tried to emulate that tutorial for Austin. I started an Austin repl like so:
Then I looked at the value of
(cemerick.austin.repls/browser-connected-repl-js)
and used it for manual inclusion in the index.html.
I made sure that the cljs source requires
Loading index.html does initiates a connection, but errors out with this message:
Can this be fixed?
If LightTable can do it, I'm hopeful Austin can too.
The text was updated successfully, but these errors were encountered: