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:
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));
|
||||
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") {
|
||||
|
|
|
@ -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") {
|
||||
|
|
Loading…
Add table
Reference in a new issue