Installations
npm install tsrpc-browser
Developer Guide
Typescript
No
Module System
CommonJS, ESM
Node Version
18.15.0
NPM Version
9.5.0
Score
72.2
Supply Chain
64.3
Quality
77.6
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (87.67%)
JavaScript (9.65%)
HTML (2.68%)
validate.email 🚀
Verify real, reachable, and deliverable emails with instant MX records, SMTP checks, and disposable email detection.
Developer
k8w
Download Statistics
Total Downloads
52,445
Last Day
16
Last Week
48
Last Month
244
Last Year
14,300
GitHub Statistics
MIT License
10 Stars
167 Commits
8 Forks
2 Watchers
3 Branches
2 Contributors
Updated on Jan 08, 2025
Bundle Size
171.67 kB
Minified
48.73 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.4.16
Package Id
tsrpc-browser@3.4.16
Unpacked Size
34.00 kB
Size
5.97 kB
File Count
6
NPM Version
9.5.0
Node Version
18.15.0
Published on
May 04, 2024
Total Downloads
Cumulative downloads
Total Downloads
52,445
Last Day
166.7%
16
Compared to previous day
Last Week
-15.8%
48
Compared to previous week
Last Month
-2.8%
244
Compared to previous month
Last Year
-23.4%
14,300
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Browser Client of TSRPC
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
Introduction
HttpClient
is using XMLHttpRequest
, and WebSocketClient
is using WebSocket
of browser.
Platform adapted to XMLHttpRequest
and WebSocket
(like ReactNative
) can also use this library.
Usage
1import { HttpClient } from 'tsrpc-browser'; 2import { serviceProto } from './shared/protocols/serviceProto'; 3 4// Create the Client 5let client = new HttpClient(serviceProto, { 6 server: 'http://127.0.0.1:3000', 7 logger: console 8}); 9 10async function yourFunc() { 11 // Call API 12 let ret = await client.callApi('Hello', { 13 name: 'World' 14 }); 15 16 // Error: ret.err is TsrpcError 17 if (!ret.isSucc) { 18 alert('Error: ' + ret.err.message); 19 return; 20 } 21 22 // Success: ret.res is ResHello 23 alert('Success: ' + ret.res.reply); 24}
Browser Support
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:
- IE8+
- Chrome
- Firefox
- Safari
- etc...
Caution
- To support Internet Explorer, you should import
es6-promise
polyfill by yourself. - WebSocket only support IE10+.

No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
Found 1/29 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 2 are checked with a SAST tool
Score
3
/10
Last Scanned on 2025-03-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More