diff options
author | Nikolai Vavilov <vvnicholas@gmail.com> | 2020-02-17 19:49:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-17 12:49:30 -0500 |
commit | 19080667534954ac75caa1bcf34e3a55d5d55e4c (patch) | |
tree | 9750fd01b45824c650300f69fb6415e117dcea2e | |
parent | 2e7d449623b7faee8feb0a2970e0d6bb7c66b409 (diff) |
Update ws client example (#4012)
-rw-r--r-- | std/ws/README.md | 5 | ||||
-rw-r--r-- | std/ws/example_client.ts | 5 |
2 files changed, 4 insertions, 6 deletions
diff --git a/std/ws/README.md b/std/ws/README.md index 39bac4741..c3b3fe2c6 100644 --- a/std/ws/README.md +++ b/std/ws/README.md @@ -101,9 +101,8 @@ console.log(green("ws connected! (type 'close' to quit)")); const tpr = new TextProtoReader(new BufReader(Deno.stdin)); while (true) { await Deno.stdout.write(encode("> ")); - const [line, err] = await tpr.readLine(); - if (err) { - console.error(red(`failed to read line from stdin: ${err}`)); + const line = await tpr.readLine(); + if (line === Deno.EOF) { break; } if (line === "close") { diff --git a/std/ws/example_client.ts b/std/ws/example_client.ts index d5c5f3058..53b1a4ed5 100644 --- a/std/ws/example_client.ts +++ b/std/ws/example_client.ts @@ -30,9 +30,8 @@ console.log(green("ws connected! (type 'close' to quit)")); const tpr = new TextProtoReader(new BufReader(Deno.stdin)); while (true) { await Deno.stdout.write(encode("> ")); - const [line, err] = await tpr.readLine(); - if (err) { - console.error(red(`failed to read line from stdin: ${err}`)); + const line = await tpr.readLine(); + if (line === Deno.EOF) { break; } if (line === "close") { |