CarterA / Tribo

Extremely fast static site generator written in Objective-C
http://cartera.me/2011/10/16/made-on-a-mac/
Other
42 stars 6 forks source link

Sandbox-friendly page-refresh. #29

Closed sgoodwin closed 12 years ago

sgoodwin commented 12 years ago

We currently need the Apple Event sending exception to make Safari auto-refresh work. This could definitely be improved by having a browser-agnostic auto-refresh system, but I haven't figured that out yet.

CarterA commented 12 years ago

Yep. The "right way" to do this is through a JavaScript WebSocket connection to the app. Which means we need:

  1. A way to inject the <script> code into each page.
  2. A WebSocket server in the app.
  3. A WebSocket JS client library (these exist).
CarterA commented 12 years ago

For the record, this actually won't be as hard as I was thinking, because the CocoaHTTPServer project that we already include has a WebSocket server class already.

sgoodwin commented 12 years ago

Why websockets and not just auto-refresh?

CarterA commented 12 years ago

WebSockets are how you implement efficient "auto-refresh". I don't want the page to just be constantly refreshing itself in the browser, that's inefficient and annoying. You should have the page open in the browser, the page opens a socket connection to the app, the app sends a "page needs to be refreshed" command through the socket whenever a file is changed.

sgoodwin commented 12 years ago

I guess that makes more sense. :P

CarterA commented 12 years ago

Completed and merged.