stunn / jssketch

1 stars 0 forks source link

Allow running on a remote device #27

Open mattlunn opened 11 years ago

mattlunn commented 11 years ago

Some ideas;

  1. Selecting "Run on Remote" will have to generate a URL for the remote client to connect to. There is no guarantee the sketch will have been saved yet, so a new URL might be best.
  2. Navigating to the URL will load a preview of the sketch. Re-pressing "Run" on the "server" must reload the page on the client
  3. Console output should be sent from the client to the "server".
  4. The server should be able to send commands to the client, which are evaluated and the results returned.
  5. This behaviour is similar to that when debugging in the same session, albeit with a network transport rather than postMessage or such like (to pass console output to the console tab).

SocketIO seems great for this; with our own wrapper to use SocketIO when remote, or postMessage when in normal operation. Points to remember; buffering console logging on the client (in the case of logging in a (infinite) loop). Circular references in a object being logged.

jstephenson commented 11 years ago

Yeah, remembering discussing this briefly when we were brainstorming initially, sounds good.

Plus we get to use another JS library - wonderful :P!