JonyEpsilon / gorilla-repl

A rich REPL for Clojure in the notebook style.
http://gorilla-repl.org
MIT License
887 stars 104 forks source link

Modified to allow for hooks into the code #174

Open dpp opened 9 years ago

dpp commented 9 years ago

This pull request updates a lot of Gorilla REPL to allow for an external system to hook into Gorilla REPL.

There are options for overriding fixed strings in the client by sending configuration information (e.g., Title).

The worksheet.html file can live at a different context path and all the services are relative to this context path (e.g., /worksheet.html becomes /foo/bar/worksheet.html)

Resources (e.g., webservices URLs, MathJax, etc.) are accessed securely if the original page was served via HTTPS.

There's a 1 second ping between the client and server (over the websocket) to keep the web socket alive across proxies.

ghost commented 9 years ago

Hey, Interesting patch, could you explain the use case for each feature a bit?

By overriding fixed strings, do you mean overriding the welcome message?

Is the context path the clojure namespace path of the file? If not, wat would it be used for? Multiuser systems with different services for each user?

Why piggyback data send by the server onto the ping? Doesn't this create a potential latency of one second for mushed info? Why not have a separate message type?

Happy holidays, Cheers Jan

dpp commented 9 years ago

Overriding the welcome message and some of the other text allows customization of the UI experience.

When I used Gorilla as part of https://vimeo.com/109288432 I needed to change up some strings and served it via https to a session-unique URL... e.g. https://telegr.am/visi/xxxyyyzzz/worksheet.html

Serving to that URL (using HAProxy to send the HTTP traffic to the correct URL) means changing up the path in both the browser and the server.

I looked for a way to send messages from the server to the client, but there's no place I could find to store the websocket on the server (and associate it with the session), so I opted for a ping/poll model.

JonyEpsilon commented 9 years ago

Thanks David. I'll take a look at this shortly when I have a chance :-)

JonyEpsilon commented 9 years ago

Hi David,

sorry for the slow reply. I’ve had a chance to think about the changes in this PR, and it also prompted some more general thinking about what should be in the core of Gorilla, and what is more appropriate in a fork. And I don’t think very quickly!

Let me try and comment separately on each part of the PR:

I hope that doesn’t come across as too negative. I really appreciate you sending the changes through, and it has prompted some useful and serious thinking about the direction I want Gorilla to go in. Or, perhaps more truthfully, the direction I have the resources to keep it going in! And I am open to disagreement and argument on anything I’ve said :-)

In terms of action: I can pick out the bits of the PR that I’d like to merge in, if you’re happy with that. Or I’m happy if you want to change the PR. And of course, I’m happy for the discussion to continue before doing anything to the code :-)

Jony

dpp commented 9 years ago

Jony,

After reading your feedback, I realize that what I'm doing is not well aligned with where you are taking Gorilla REPL. I am a firm believer in respecting the project founder because the founder's vision is important in making a project something useful for all.

I think the best bet is the fork option for me. Please take whatever bits and pieces you want from this PR (or ignore it altogether).

I will continue to maintain a fork of Gorilla REPL that has the pieces I need... more of the Gorilla as library rather than Gorilla as app. If there's anything that's app-general (e.g., a better keep alive mechanism for the web socket), I'll ping you and see if you want it.

Thanks for building something great and thanks for your thoughtful comments!

Rock on!

David

PS -- I'll leave it to you to close the PR or continue the conversation... either is cool with me.

JonyEpsilon commented 9 years ago

Hi David,

thanks for the considered reply. I'm still trying to feel out the scope of Gorilla - my main fear is expanding beyond my or others' ability to continue maintaining the project, as I wouldn't like to see it turn into abandonware.

The plan of working on a fork sounds like a good one, and I'll try and keep an eye on it - and also keep you up to speed as the plan for Gorilla evolves.

I'll leave the PR open and pull out the bits that are going to go in when I have a chance.

Thanks again,

Jony