diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2023-05-01 18:07:32 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-01 14:37:32 +0200 |
commit | 89160e7cd8647fdf2ebaec45259775be89aa69c7 (patch) | |
tree | a9b5df0d14ee59b6de7105d72557d4643bad41e9 /ext/websocket/autobahn/autobahn_server.js | |
parent | b31cf9fde6ad5398c20370c136695db77df6beeb (diff) |
chore(ext/websocket): readd autobahn|testsuite fuzzingclient (#18903)
This reverts commit
https://github.com/denoland/deno/commit/17d1c7e444542f43229a047853605ac22081abdf.
The `Deno.serve` signature update in
https://github.com/denoland/deno/pull/18759 broke the testee server
right after this patch landed on `main`.
Diffstat (limited to 'ext/websocket/autobahn/autobahn_server.js')
-rw-r--r-- | ext/websocket/autobahn/autobahn_server.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/websocket/autobahn/autobahn_server.js b/ext/websocket/autobahn/autobahn_server.js new file mode 100644 index 000000000..b5f399a5b --- /dev/null +++ b/ext/websocket/autobahn/autobahn_server.js @@ -0,0 +1,20 @@ +// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. +import { parse } from "../../../test_util/std/flags/mod.ts"; + +const { port } = parse(Deno.args, { + number: ["port"], + default: { + port: 6969, + }, +}); + +const { serve } = Deno; + +// A message-based WebSocket echo server. +serve({ port }, (request) => { + const { socket, response } = Deno.upgradeWebSocket(request); + socket.onmessage = (event) => { + socket.send(event.data); + }; + return response; +}); |