A debug tool to proxy js code execution from one browser to another.

npm install code-proxy
20 downloads in the last week
21 downloads in the last month

A Node.js tools that give the ability to execute JavaScript code in one client browser and to get the results in another. Based on HTTP (for static files and sync post requests) and WebSocket (for server-host communications) technologies. Supports CommonJS modules and can be used with Browserify on the client-side.

Scheme to illustrate base working principles: scheme


npm install code-proxy


Start as a standalone server:

node server/main.js

Connect to an existing project:


// or it's possible to redefine default options

    portHttp   : 8800,
    portWs     : 8900,
    retryDelay : 100,
    retryLimit : 30,
    logging    : true


Host client (accepts requests, execute them and send back result of execution):

<script type="text/javascript" src="host.js"></script>
// default host/port/session
var proxy = new ProxyHost();

// prepare for guest call
localStorage.setItem('test', 'localStorage test string on the host');

// test func for remote exec
function doSomething ( param ) {
    return 'some host work with "' + param + '" is done';

Guest client (send requests to the host):

<script type="text/javascript" src="guest.js"></script>
// default host/port/session
var proxy = new ProxyGuest();

// examples
proxy.json('screen');'localStorage.getItem', ['test'], 'localStorage');'doSomething', ['test data']);

Proxy server host/port and session name can be redefined on both host and guest:

var proxy = new ProxyGuest({
    host : '',
    port : 8800,
    name : 'anonymous'

ProxyHost has some additional options: reconnect and reconnectInterval to automatically try to restore connection on disconnect every 5 seconds. It's active be default.

npm loves you