ctn-archive / nengo_gui_2014

HTML5 graphical interface for Nengo -- now obsolete! Please use https://github.com/nengo/nengo_gui instead
Other
6 stars 0 forks source link

Allow use of a separate editor #26

Closed tcstewar closed 10 years ago

tcstewar commented 10 years ago

You should be able to use your own editor, rather than the built-in GUI one.

tcstewar commented 10 years ago

The basics of this now work. At the moment, you have to specify a command-line parameter to enable this feature, specifying the time to poll the server (in milliseconds):

python main.py --refresh 100

I don't think this is the best way to do it. Suggestions?

tbekolay commented 10 years ago

I know that you can listen for FS events on Mac and Linux but I don't know about Windows. But you can look into how web frameworks do this, as I know at least Flask will auto-refresh things if you change a file on disk.

tcstewar commented 10 years ago

I don't mind the server polling the hard drive for changes -- that's pretty low-cost. My worry is more the client polling the server. At the moment we're doing everything through standard XMLHttpRequests, so it's all pull-based, rather than push. So right now the client just does a setInterval and fires off a request to the server on a regular basis to ask it if anything has changed.

tbekolay commented 10 years ago

Oh, I see. Perhaps the EventSource API? Blog post

jgosmann commented 10 years ago

I think, you can open an HTTP connection and leave it open until the server has to send some data. I believe, that's how we did it in a company I worked for, but I was never concerned with the details of that part of the application. Also, the browser might close the connection itself after a timeout, which would require to reconnect automatically. A lot of dangling open connections on the server side is in our use case probably not a huge concern.

The links posted by @tbekolay might provide better solutions.

tcstewar commented 10 years ago

I think for now we'll leave it how it is, but after the summer school I'll look more into the EventSource API. Thanks for the suggestions!