First release
This commit is contained in:
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
node_modules
|
||||
*.log
|
||||
.DS_Store
|
||||
lib
|
||||
coverage
|
||||
.idea
|
21
LICENSE.md
Normal file
21
LICENSE.md
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Mihail Diordiev
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
30
README.md
Normal file
30
README.md
Normal file
@ -0,0 +1,30 @@
|
||||
RemoteDev Server
|
||||
================
|
||||
|
||||
Bridge for connecting [remotedev monitor app](https://github.com/zalmoxisus/remotedev-app) with [Remote Redux DevTools](https://github.com/zalmoxisus/remote-redux-devtools) or [RemoteDev](https://github.com/zalmoxisus/remotedev) using a local server. Running a local server is optional, you may use [remotedev.io](remotedev.io) server instead, which is by default.
|
||||
|
||||
### Installation
|
||||
|
||||
```
|
||||
npm install --save-dev remotedev-server
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
```
|
||||
remotedev --hostname=localhost --port=8000
|
||||
```
|
||||
|
||||
Change `hostaname` and `port` to the values you want.
|
||||
|
||||
### Connect from Android device or emulator
|
||||
|
||||
If you're running an Android 5.0+ device connected via USB or an Android emulator, use [adb command line tool](http://developer.android.com/tools/help/adb.html) to setup port forwarding from the device to your computer:
|
||||
|
||||
```
|
||||
adb reverse tcp:8000 tcp:8000
|
||||
```
|
||||
|
||||
### License
|
||||
|
||||
MIT
|
10
bin/remotedev.js
Executable file
10
bin/remotedev.js
Executable file
@ -0,0 +1,10 @@
|
||||
#! /usr/bin/env node
|
||||
var argv = require('minimist')(process.argv.slice(2));
|
||||
var SocketCluster = require('socketcluster').SocketCluster;
|
||||
|
||||
var socketCluster = new SocketCluster({
|
||||
host: argv.hostname || null,
|
||||
port: Number(argv.port) || 8000,
|
||||
workerController: __dirname + '/worker.js',
|
||||
allowClientPublish: false
|
||||
});
|
27
bin/worker.js
Normal file
27
bin/worker.js
Normal file
@ -0,0 +1,27 @@
|
||||
module.exports.run = function(worker) {
|
||||
var scServer = worker.scServer;
|
||||
|
||||
scServer.addMiddleware(scServer.MIDDLEWARE_EMIT, function (socket, channel, data, next) {
|
||||
if (channel.substr(0, 3) === 'sc-' || channel === 'respond' || channel === 'log') {
|
||||
scServer.exchange.publish(channel, data);
|
||||
} else if (channel === 'log-noid') {
|
||||
scServer.exchange.publish('log', { id: socket.id, data: data });
|
||||
}
|
||||
next();
|
||||
});
|
||||
|
||||
scServer.on('connection', function(socket) {
|
||||
socket.on('login', function (credentials, respond) {
|
||||
var channelName = credentials === 'master' ? 'respond' : 'log';
|
||||
worker.exchange.subscribe('sc-' + socket.id).watch(function(msg) {
|
||||
socket.emit(channelName, msg);
|
||||
});
|
||||
respond(null, channelName);
|
||||
});
|
||||
socket.on('disconnect', function() {
|
||||
var channel = worker.exchange.channel('sc-' + socket.id);
|
||||
channel.unsubscribe(); channel.destroy();
|
||||
scServer.exchange.publish('log', { id: socket.id, type: 'DISCONNECTED' });
|
||||
});
|
||||
});
|
||||
};
|
29
package.json
Normal file
29
package.json
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "remotedev-server",
|
||||
"version": "0.0.1",
|
||||
"description": "Run remotedev monitor on your local server.",
|
||||
"bin": {
|
||||
"remotedev": "bin/remotedev.js"
|
||||
},
|
||||
"files": [
|
||||
"bin"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zalmoxisus/remotedev-server.git"
|
||||
},
|
||||
"keywords": [
|
||||
"devtools",
|
||||
"remotedev"
|
||||
],
|
||||
"author": "Mihail Diordiev <zalmoxisus@gmail.com> (https://github.com/zalmoxisus)",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/zalmoxisus/remotedev-server/issues"
|
||||
},
|
||||
"homepage": "https://github.com/zalmoxisus/remotedev-server",
|
||||
"dependencies": {
|
||||
"minimist": "^1.2.0",
|
||||
"socketcluster": "^3.0.0"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user