adobe-photoshop/generator-core — pull request #233 by iwehrman (2014-07-16 01:04:56+00:00)
Title: Websocket RPC infrastructure

This adds Websocket-based RPC infrastructure to Generator. Much of this code originally came from [Brackets-shell](https://github.com/adobe/brackets-shell/tree/master/appshell/node-core), but has been refactored and simplified for this use case.

This pull request adds the following methods to the `Generator` object:

* `Generator.prototype.getCustomOptions` - Asynchronously stores a dictionary per-plugin in the Photoshop memory space. Accessible via ExtendScript.
* `Generator.prototype.setCustomOptions`- Asynchronously retrieves the aforementioned dictionaries per-plugin.
* `Generator.prototype.startWebsocketServer` - Starts the Websocket server per-plugin. The port can either be specified or dyamically assigned.
* `Generator.prototype.stopWebsocketServer` - Stops the Websocket server per-plugin.

To test:
1. Install the [generator-rpc-example plugin](https://github.com/iwehrman/generator-rpc-example)
2. Clone the [node-connection-example](https://github.com/iwehrman/node-connection-example)
3. Run `bower install` in the `node-connection-example` directory
4. Visit `file://.../node-connection-example/index.html` in Chrome

The `node-connection-example` relies on a hard-coded port number that's shared between the example plugin and the example client code. Eventually the [generator-connection](http://github.com/adobe-photoshop/generator-connection) repo will be updated so that Photoshop can (by some mechanism) be used as the intermediary to communicate dynamically assigned ports, but it doesn't do that just yet.