Skip to content

Commit

Permalink
chore: update demos to use JSON-RPC responses async iterator
Browse files Browse the repository at this point in the history
  • Loading branch information
tien committed Aug 14, 2024
1 parent df103ae commit 3a048a2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions wasm-node/javascript/demo/demo-deno.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ while(true) {

(async () => {
try {
while(true) {
const response = await chain.nextJsonRpcResponse();
for await (const response of chain.jsonRpcResponses) {
socket.send(response);
}
} catch(_error) {}
Expand Down
6 changes: 2 additions & 4 deletions wasm-node/javascript/demo/demo.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,7 @@ wsServer.on('connection', function (connection, request) {

(async () => {
try {
while(true) {
const response = await para.nextJsonRpcResponse();
for await (const response of para.jsonRpcResponses) {
connection.send(response);
}
} catch(_error) {}
Expand All @@ -177,8 +176,7 @@ wsServer.on('connection', function (connection, request) {

(async () => {
try {
while(true) {
const response = await relay.nextJsonRpcResponse();
for await (const response of relay.jsonRpcResponses) {
connection.send(response);
}
} catch(_error) {}
Expand Down

0 comments on commit 3a048a2

Please sign in to comment.