fixed requests

This commit is contained in:
2026-02-09 12:46:41 +01:00
parent 8c113f042d
commit 7b5f41d167
2 changed files with 10 additions and 0 deletions
+7
View File
@@ -22,6 +22,13 @@ app.prepare().then(() => {
const wss = new WebSocketServer({ noServer: true });
// Request
server.on("request", (req) => {
if (!req.url || !req.method) return;
config?.app.emit(req.method as any, req.url, toRequest(req));
});
// Upgrade HTTP → WebSocket
server.on("upgrade", (req, socket, head) => {
if (!req.url) return;
+3
View File
@@ -9,6 +9,9 @@ export interface WsRouteHandler {
upgrade?: (req: Request, socket: Duplex, head: NonSharedBuffer) => void;
post?: (req: Request) => void;
get?: (req: Request) => void;
put?: (req: Request) => void;
delete?: (req: Request) => void;
patch?: (req: Request) => void;
}
export class NextWebsocketApp {