重构 websocket

This commit is contained in:
ExplodingDragon
2025-11-20 23:56:14 +08:00
parent 35df220bea
commit 827f9bd273
10 changed files with 161 additions and 84 deletions

View File

@@ -8,8 +8,8 @@ const ws = websocket();
async function eventPull() {
while (true) {
const data = await event.pull('messages')
ws.writeText(data);
const data = await event.load('messages')
await ws.writeText(data);
}
}
@@ -27,5 +27,5 @@ async function messagePull() {
}
(async () => {
await Promise.all(eventPull(), messagePull())
await Promise.all([eventPull(), messagePull()])
})()