
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
tsrpc-browser
Advanced tools
TSRPC is a TypeScript RPC framework with runtime type checking and binary serialization. See more detail at https://github.com/k8w/tsrpc.
Official site: https://tsrpc.cn
HttpClient
is using XMLHttpRequest
, and WebSocketClient
is using WebSocket
of browser.
Platform adapted to XMLHttpRequest
and WebSocket
(like ReactNative
) can also use this library.
import { HttpClient } from 'tsrpc-browser';
import { serviceProto } from './shared/protocols/serviceProto';
// Create the Client
let client = new HttpClient(serviceProto, {
server: 'http://127.0.0.1:3000',
logger: console
});
async function yourFunc() {
// Call API
let ret = await client.callApi('Hello', {
name: 'World'
});
// Error: ret.err is TsrpcError
if (!ret.isSucc) {
alert('Error: ' + ret.err.message);
return;
}
// Success: ret.res is ResHello
alert('Success: ' + ret.res.reply);
}
The library is compiled to target ES2015
, so if you need legacy browser support, you can use Babel to transform the final code to ES5
. After that it can support all these browser:
Caution
es6-promise
polyfill by yourself.[3.4.16] - 2024-05-05
tsbuffer
FAQs
TSRPC Client for browser
The npm package tsrpc-browser receives a total of 35 weekly downloads. As such, tsrpc-browser popularity was classified as not popular.
We found that tsrpc-browser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.