diff --git a/wasm-node/javascript/demo/demo-deno.ts b/wasm-node/javascript/demo/demo-deno.ts index 8e3d68876f..c0b80d7508 100644 --- a/wasm-node/javascript/demo/demo-deno.ts +++ b/wasm-node/javascript/demo/demo-deno.ts @@ -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) {} diff --git a/wasm-node/javascript/demo/demo.mjs b/wasm-node/javascript/demo/demo.mjs index f534d06ea1..e82598ba12 100644 --- a/wasm-node/javascript/demo/demo.mjs +++ b/wasm-node/javascript/demo/demo.mjs @@ -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) {} @@ -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) {}