![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
@therms/rpc-client
Advanced tools
A Remote Procedure Call framework for Javascript environments (Node.js & Browser).
npm i @therms/rpc-client
import { RPCClient } from '@therms/rpc-client'
/* Create a client instance */
const rpc = new RPCClient({
hosts: {
http: 'http://localhost:3995/rpc',
websocket: 'ws://localhost:3996', // optional
},
});
/* Make a remote procedure call */
const {
code, // http status code, ie: 200
data, // any data returned from the remote/server
message, // a human readable message from the remote/server
success, // boolean, true|false if the procedure was succesful
} = await rpc.call({
// optional
args: {
email: 'me@gmail.com',
password: '1234567',
},
procedure: 'login',
// optional
scope: 'auth',
// optional
version: '1',
});
const rpc = new RPCClient({
cacheMaxAgeMs: 5 * 60 * 1000, // optional
deadlineMs: 5000, // optional
hosts: {
http: 'localhost:3995/rpc',
},
});
const rpc = new RPCClient({
hosts: {
http: 'localhost:3995/rpc',
},
requestInterceptor: (request) => {
request.args.count = request.args.count + 1;
return request;
},
});
const { data } = await rpc.call({
args: { count: 1 },
procedure: 'intercept-request',
});
console.log(data.count); // => 2
const rpc = new RPCClient({
hosts: {
http: 'localhost:3995/rpc',
},
responseInterceptor: (response) => {
response.data.count = 100;
return response;
},
});
const { data } = await rpc.call({
args: { count: 1 },
procedure: 'intercept-request',
});
console.log(data.count); // => 100
First, setup a custom Transport
:
see the required interface in
src/client/Transports/Transport.ts
class CustomHTTPTransport {
isConnected() {
return true;
}
name: 'CustomHTTPTransport';
async sendRequest(call) {
const response = await fetch('localhost:3901/rpc', {
data: call,
}).then((res) => res.json());
return response;
}
setIdentity(identity) {
this.identity = identity;
}
}
Then, use the CustomHTTPTransport
when you create a client instance:
const rpc = new RPCClient({
cacheMaxAgeMs: 5 * 60 * 1000, // optional
deadlineMs: 5000, // optional
transports: {
http: new CustomHTTPTransport(),
},
});
FAQs
RPC framework, browser client lib
The npm package @therms/rpc-client receives a total of 0 weekly downloads. As such, @therms/rpc-client popularity was classified as not popular.
We found that @therms/rpc-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.