0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

Update ws client example (#4012)

This commit is contained in:
Nikolai Vavilov 2020-02-17 19:49:30 +02:00 committed by GitHub
parent 2e7d449623
commit 1908066753
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View file

@ -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") {

View file

@ -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") {