MCPcopy
hub / github.com/tsrpc/tsrpc / main

Function main

try/massive.ts:4–25  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import { serviceProto, ServiceType } from './proto/serviceProto';
3
4async function main() {
5 setInterval(() => {
6 for (let i = 0; i < 100; ++i) {
7 let client = new TSRPCClient<ServiceType>({
8 server: 'ws://127.0.0.1:3000',
9 proto: serviceProto
10 });
11
12 client.connect().then(() => {
13 client.callApi('a/b/c/Test1', { name: '小明同学' }).then(v => {
14 // console.log('成功', v)
15 }).catch(e => {
16 console.error('错误', e.message)
17 }).then(() => {
18 client.disconnect();
19 });
20 }).catch(e => {
21 console.error('连接错误', e)
22 })
23 }
24 }, 1000)
25}
26
27main();

Callers 1

massive.tsFile · 0.70

Calls 4

connectMethod · 0.80
disconnectMethod · 0.80
errorMethod · 0.65
callApiMethod · 0.45

Tested by

no test coverage detected