summaryrefslogtreecommitdiffstats
path: root/debian/perl-framework/t/htdocs/modules/lua/websockets.lua
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-25 04:41:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-25 04:41:28 +0000
commit2eeb62e38ae17a3523ad3cd81c3de9f20f9e7742 (patch)
treefe91033d4712f6d836006b998525656b9dd193b8 /debian/perl-framework/t/htdocs/modules/lua/websockets.lua
parentMerging upstream version 2.4.59. (diff)
downloadapache2-debian.tar.xz
apache2-debian.zip
Adding debian version 2.4.59-1~deb10u1.debian/2.4.59-1_deb10u1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/perl-framework/t/htdocs/modules/lua/websockets.lua')
-rw-r--r--debian/perl-framework/t/htdocs/modules/lua/websockets.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/debian/perl-framework/t/htdocs/modules/lua/websockets.lua b/debian/perl-framework/t/htdocs/modules/lua/websockets.lua
new file mode 100644
index 0000000..6e6d5ba
--- /dev/null
+++ b/debian/perl-framework/t/htdocs/modules/lua/websockets.lua
@@ -0,0 +1,18 @@
+function handle(r)
+if r:wsupgrade() then -- if we can upgrade:
+ while true do
+ local line, isFinal = r:wsread()
+ local len = string.len(line);
+ r:debug(string.format("writing line of len %d: %s", len, line))
+ if len >= 1024 then
+ r:debug("writing line ending in '" .. string.sub(line, -127, -1) .. "'")
+ end
+ r:wswrite(line)
+ if line == "quit" then
+ r:wsclose() -- goodbye!
+ break
+ end
+
+ end
+end
+end