An open API service indexing awesome lists of open source software.

https://github.com/chiro-hiro/mrpepe

Mr. Pepe is a protocol to work with remote object over udp
https://github.com/chiro-hiro/mrpepe

microservice mrpepe udp

Last synced: about 1 year ago
JSON representation

Mr. Pepe is a protocol to work with remote object over udp

Awesome Lists containing this project

README

          





# Mr. Pepe
Mr. Pepe provide protocol to work with remote object over UDP.

# How to create Mr. Pepe server?
```javascript
const mrPepe = require('mrpepe');
const crypto = require('crypto');

var localObject = {
sha256: (data) => {
return crypto.createHash('sha256').update(data).digest().toString('hex');
},
sum: (a, b) => {
return a+b;
}
};

var server = new mrPepe.server({
address: '127.0.0.1',
port: 3301,
protocol: 'udp4',
child: 4
}, localObject);

server.start();
```

This source code create a service binding to port 3301 with 4 child process. All method of `localObject` will be provide as res API. Of couse Mr. Pepe support UDP/IPv4 and UDP/IPv6.

# How to create Mr. Pepe client?
```javascript
const mrPepe = require('mrpepe');

var client = new mrPepe.client({
address: '127.0.0.1',
port: 3301,
protocol: 'udp4',
});

client.call('sha256', [new Buffer('Chiro may cry!.')], (error, data, rinfo) => {
console.log(`Error: ${error}\nData: ${data}\nFrom: ${rinfo.address}:${rinfo.port}.`);
});

client.call('sum', [4,5], (error, data, rinfo) => {
console.log(`Error: ${error}\nData: ${data}\nFrom: ${rinfo.address}:${rinfo.port}.`);
});
```
This source code create UDP datagram connect to server following configuration. It'll trigger `localObject` over UPD.

# Future works
- Support callback function
- Parsing parameters in `Buffer` type
- Encrypt transfer data

# License
This software distributed under [MIT License](https://github.com/tad88dev/pepe/blob/master/LICENSE)