Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/bkniffler/rpc1
- Owner: bkniffler
- License: mit
- Created: 2019-03-13T00:42:12.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-04-07T15:29:20.000Z (over 5 years ago)
- Last Synced: 2024-10-10T02:07:22.621Z (3 months ago)
- Language: TypeScript
- Size: 226 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
rpc1
Proxy any async service through sockets or other transport. Works with promises and subscriptions.
## 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 () => {};
```