A debug tool to proxy js code execution from one browser to another.
Scheme to illustrate base working principles:
npm install code-proxy
Start as a standalone server:
Connect to an existing project:
require'code-proxy';// or it's possible to redefine default optionsrequire'code-proxy'portHttp: 8800portWs: 8900retryDelay: 100retryLimit: 30logging: true;
Host client (accepts requests, execute them and send back result of execution):
// default host/port/sessionvar proxy = ;// prepare for guest calllocalStoragesetItem'test' 'localStorage test string on the host';// test func for remote execreturn 'some host work with "' + param + '" is done';
Guest client (send requests to the host):
// default host/port/sessionvar proxy = ;// examplesproxyeval'1+1';proxyeval'window.navigator.userAgent';proxyjson'screen';proxycall'localStorage.getItem' 'test' 'localStorage';proxycall'doSomething' 'test data';
Proxy server host/port and session name can be redefined on both host and guest:
var proxy =host: '127.0.0.1'port: 8800name: 'anonymous';
Both host and guest proxy instance have
active boolean flag to determine the current connection to the proxy server status.
ProxyHost has some additional options:
reconnectInterval to automatically try to restore connection on disconnect every 5 seconds. It's active be default.