New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@gobark/udprpc

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gobark/udprpc - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

CONTRIBUTING.md

0

dist/code/Config.js

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@

4

package.json
{
"name": "@gobark/udprpc",
"version": "0.0.2",
"version": "0.0.3",
"description": "A UDP-based JSON-RPC 2.0 library for peer-to-peer communications with support for ES6 promises",
"main": "dist/index.js",
"main": "dist/code/UdpRpc.js",
"scripts": {

@@ -7,0 +7,0 @@ "test": "grunt test",

@@ -10,30 +10,63 @@ [![Build Status](https://travis-ci.org/perspectivus1/udprpc.svg?branch=master)](https://travis-ci.org/perspectivus1/udprpc)

## Installation
## Installation ##
```
npm install
npm install @gobark/udprpc
```
## Development Environment
The code, including tests, is written in TypeScript. The source files are located in the ```code``` folder. The tests and related files are located in the ```tests``` folder.
The transpiled JavaScript code retains the above structure but resides in the ```dist``` folder.
## Usage ##
UdpRpc instance listens to the same port from which it executes requests.
We use npm and Grunt to build the code and run tests. Mocha is our test framework.
### Build Process
* Linting the code
* Transpiling code from TypeScript to JavaScript.
### Server ###
```
const url = require("url");
// import UdpRpc
const UdpRpc = require("@gobark/udprpc").UdpRpc;
// create a new instance of UdpRpc
let udpRpcServer = new UdpRpc(3000);
// start listening
udpRpcServer.start();
// handle incoming requests
udpRpcServer.register((method, params, url, resolve, reject) => {
switch (method) {
case "sum": {
if (isNaN(params[0]) || isNaN(params[1])) {
reject("Parameters must be numbers");
} else {
resolve(Number(params[0]) + Number(params[1]));
}
break;
}
case "concat": {
resolve(`${params[0]}${params[1]}`);
break;
}
}
Run this command to start the build process:
```npm run build```
### Test Process
* Running tests
* Checking code coverage
// stop server when needed
// udpRpcServer.stop();
});
```
### Client ###
```
// import UdpRpc
const UdpRpc = require("UdpRpc");
// create a new instance of UdpRpc
let udpRpcClient = new UdpRpc(3001);
// start listening
udpRpcClient.start();
return udpRpcClient.send("sum", [ 1, 2 ], url.parse(`http://127.0.0.1:3000`)).then((response) => {
console.log(response); // response === 3
}).catch((err) => {
console.error(err);
}).then(() => {
// stop client
udpRpcClient.stop();
});
```
Run these commands to execute the tests and coverage respectively: ```npm test``` and ```npm run coverage```
## Contribution guidelines ##
[See CONTRIBUTING.md](./CONTRIBUTING.md)
This runs all the tests that reside in the ```dist/tests``` folder.
### Contribution guidelines ###
Never lower the code coverage thresholds specified in the Gruntfile.
### Who do I talk to? ###
## Who do I talk to? ##
* perspectivus@gmail.com
* lutraki@gmail.com

@@ -0,0 +0,0 @@ {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc