修复 event 案例错误,为 redirect 添加重定向配置

This commit is contained in:
dragon
2025-11-21 13:54:48 +08:00
parent 858ea9f9cf
commit 277f7e4226
2 changed files with 18 additions and 6 deletions

View File

@@ -12,11 +12,15 @@ async function eventPull() {
await ws.writeText(data);
}
}
async function messagePull() {
while (true) {
const data = await ws.readText()
if (data === "exit") break;
if (data === "exit")
await event.put("messages", JSON.stringify({
name:name,
data: name+' 已断开连接'
}));
break;
if (data?.trim()) {
await event.put("messages", JSON.stringify({
name:name,
@@ -27,5 +31,5 @@ async function messagePull() {
}
(async () => {
await Promise.all([eventPull(), messagePull()])
await Promise.any([eventPull(), messagePull()])
})()