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) {} diff --git a/wasm-node/javascript/src/public-types.ts b/wasm-node/javascript/src/public-types.ts index e90f7ab30a..9cafae44d9 100644 --- a/wasm-node/javascript/src/public-types.ts +++ b/wasm-node/javascript/src/public-types.ts @@ -179,8 +179,7 @@ export interface Chain { /** * JSON-RPC responses or notifications to be generated. - * - * @throws {@link AlreadyDestroyedError} If the chain has been removed or the client has been terminated. + * * @throws {@link JsonRpcDisabledError} If the JSON-RPC system was disabled in the options of the chain. * @throws {@link CrashError} If the background client has crashed. */