修复 event 案例错误,为 redirect 添加重定向配置
This commit is contained in:
@@ -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()])
|
||||
})()
|
||||
Reference in New Issue
Block a user