Webchat: clean server build and add ws types
This commit is contained in:
@@ -51,6 +51,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "^2.3.8",
|
"@biomejs/biome": "^2.3.8",
|
||||||
"@mariozechner/mini-lit": "0.2.1",
|
"@mariozechner/mini-lit": "0.2.1",
|
||||||
|
"@types/ws": "^8.5.12",
|
||||||
"@types/body-parser": "^1.19.6",
|
"@types/body-parser": "^1.19.6",
|
||||||
"@types/express": "^5.0.6",
|
"@types/express": "^5.0.6",
|
||||||
"@types/node": "^24.10.1",
|
"@types/node": "^24.10.1",
|
||||||
|
|||||||
@@ -405,7 +405,7 @@ export async function startWebChatServer(port = WEBCHAT_DEFAULT_PORT) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const sessionKey = url.searchParams.get("session") ?? "main";
|
const sessionKey = url.searchParams.get("session") ?? "main";
|
||||||
wss!.handleUpgrade(req, socket, head, (ws) => {
|
wss!.handleUpgrade(req, socket, head, (ws: WebSocket) => {
|
||||||
ws.on("close", () => {
|
ws.on("close", () => {
|
||||||
const set = wsSessions.get(sessionKey);
|
const set = wsSessions.get(sessionKey);
|
||||||
if (set) {
|
if (set) {
|
||||||
@@ -485,4 +485,3 @@ export async function ensureWebChatServerFromConfig() {
|
|||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*** End
|
|
||||||
|
|||||||
Reference in New Issue
Block a user