mirror of
https://github.com/denoland/deno.git
synced 2025-10-03 07:34:36 +00:00
Update ws client example (#4012)
This commit is contained in:
parent
2e7d449623
commit
1908066753
2 changed files with 4 additions and 6 deletions
|
@ -101,9 +101,8 @@ console.log(green("ws connected! (type 'close' to quit)"));
|
||||||
const tpr = new TextProtoReader(new BufReader(Deno.stdin));
|
const tpr = new TextProtoReader(new BufReader(Deno.stdin));
|
||||||
while (true) {
|
while (true) {
|
||||||
await Deno.stdout.write(encode("> "));
|
await Deno.stdout.write(encode("> "));
|
||||||
const [line, err] = await tpr.readLine();
|
const line = await tpr.readLine();
|
||||||
if (err) {
|
if (line === Deno.EOF) {
|
||||||
console.error(red(`failed to read line from stdin: ${err}`));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (line === "close") {
|
if (line === "close") {
|
||||||
|
|
|
@ -30,9 +30,8 @@ console.log(green("ws connected! (type 'close' to quit)"));
|
||||||
const tpr = new TextProtoReader(new BufReader(Deno.stdin));
|
const tpr = new TextProtoReader(new BufReader(Deno.stdin));
|
||||||
while (true) {
|
while (true) {
|
||||||
await Deno.stdout.write(encode("> "));
|
await Deno.stdout.write(encode("> "));
|
||||||
const [line, err] = await tpr.readLine();
|
const line = await tpr.readLine();
|
||||||
if (err) {
|
if (line === Deno.EOF) {
|
||||||
console.error(red(`failed to read line from stdin: ${err}`));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (line === "close") {
|
if (line === "close") {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue