Skip to content

Commit

Permalink
Update ws client example (denoland/deno#4012)
Browse files Browse the repository at this point in the history
  • Loading branch information
seishun authored Feb 17, 2020
1 parent 0532535 commit 2f2d00e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions ws/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down
5 changes: 2 additions & 3 deletions ws/example_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down

0 comments on commit 2f2d00e

Please sign in to comment.