1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-29 16:30:56 -05:00

/std/ws: Fix args index for WS examples (#4046)

This commit is contained in:
Clemens Tolboom 2020-02-20 16:19:14 +01:00 committed by GitHub
parent 6431622a6d
commit 7e49d96cbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View file

@ -16,7 +16,7 @@ import {
} from "https://deno.land/std/ws/mod.ts";
/** websocket echo server */
const port = Deno.args[1] || "8080";
const port = Deno.args[0] || "8080";
console.log(`websocket server is running on :${port}`);
for await (const req of serve(`:${port}`)) {
const { headers, conn } = req;
@ -80,7 +80,7 @@ import { BufReader } from "https://deno.land/std/io/bufio.ts";
import { TextProtoReader } from "https://deno.land/std/textproto/mod.ts";
import { blue, green, red, yellow } from "https://deno.land/std/fmt/colors.ts";
const endpoint = Deno.args[1] || "ws://127.0.0.1:8080";
const endpoint = Deno.args[0] || "ws://127.0.0.1:8080";
/** simple websocket cli */
const sock = await connectWebSocket(endpoint);
console.log(green("ws connected! (type 'close' to quit)"));

View file

@ -9,7 +9,7 @@ import { BufReader } from "../io/bufio.ts";
import { TextProtoReader } from "../textproto/mod.ts";
import { blue, green, red, yellow } from "../fmt/colors.ts";
const endpoint = Deno.args[1] || "ws://127.0.0.1:8080";
const endpoint = Deno.args[0] || "ws://127.0.0.1:8080";
/** simple websocket cli */
const sock = await connectWebSocket(endpoint);
console.log(green("ws connected! (type 'close' to quit)"));

View file

@ -8,7 +8,7 @@ import {
} from "./mod.ts";
/** websocket echo server */
const port = Deno.args[1] || "8080";
const port = Deno.args[0] || "8080";
console.log(`websocket server is running on :${port}`);
for await (const req of serve(`:${port}`)) {
const { headers, conn } = req;