Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/bkniffler/rpc1

Proxy any async service through sockets or other transport. Works with promises and subscriptions.
https://github.com/bkniffler/rpc1

Last synced: about 2 months ago
JSON representation

Proxy any async service through sockets or other transport. Works with promises and subscriptions.

Awesome Lists containing this project

README

        


rpc1


Proxy any async service through sockets or other transport. Works with promises and subscriptions.





Build Status


Coverage Status


Version


Language


License





## Bindings

## Why

## Install

### Yarn

## Example

### Local

```jsx
createBroker(broker => {
// Add a local service
broker.local('calculator', service => {
service.addMethod('multiply', (x1, x2) => x1 * x2);
});
// Add a local client
broker.client(async client => {
const service = client.use('calculator');
try {
console.log(await service.multiply(2, 3));
} catch (err) {
console.log(err);
}
});
});
```

### Socket

```jsx
const port = 9999;

createBroker(
broker => {
console.log('Broker is listening');
},
{
plugins: [
pluginSocketBroker({
port
})
]
}
);

// Add a remote service
createSocketService('calculator', 'http://localhost:9999', service => {
service.addMethod('multiply', (x1, x2) => x1 * x2);
});

// Add a remote client
createSocketClient('http://localhost:9999', async client => {
const service = client.use('local-calculator');
try {
console.log(await service.multiply(2, 3));
} catch (err) {
console.log(err);
}
});
```

### React

```jsx
export default () => {};
```