Closed tcstewar closed 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?
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.
Oh, I see. Perhaps the EventSource API? Blog post
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.
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!
You should be able to use your own editor, rather than the built-in GUI one.