Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F5388283
client.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
857 B
Referenced Files
None
Subscribers
None
client.js
View Options
import
{
RpcClient
}
from
'ant:rpc'
;
const
host
=
process
.
argv
[
2
]
||
'127.0.0.1'
;
const
port
=
Number
(
process
.
argv
[
3
]
||
7000
);
const
client
=
new
RpcClient
({
host
,
port
});
await
client
.
connect
();
try
{
const
[
sum
]
=
await
client
.
call
(
'add'
,
[
5
,
10
]);
console
.
log
(
'add(5, 10) ='
,
sum
);
const
[
product
]
=
await
client
.
call
(
'mul'
,
[
6
,
7
]);
console
.
log
(
'mul(6, 7) ='
,
product
);
const
[
message
]
=
await
client
.
call
(
'echo'
,
[
'hello from ant rpc'
]);
console
.
log
(
'echo ='
,
message
);
const
[
slow
]
=
await
client
.
call
(
'slow'
,
[
'done after a short delay'
]);
console
.
log
(
'slow ='
,
slow
);
const
bytes
=
new
Uint8Array
([
1
,
2
,
3
,
254
]);
const
[
roundTrip
]
=
await
client
.
call
(
'bytes'
,
[
bytes
]);
console
.
log
(
'bytes ='
,
Array
.
from
(
roundTrip
).
join
(
', '
));
await
client
.
ping
();
console
.
log
(
'ping ok'
);
}
finally
{
await
client
.
close
();
}
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Sun, May 17, 1:51 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
554698
Default Alt Text
client.js (857 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment