mirror of
https://github.com/NebulaServices/Nebula.git
synced 2025-05-17 13:30:00 -04:00
15 lines
464 B
TypeScript
15 lines
464 B
TypeScript
import { Socket } from "node:net";
|
|
import wisp from "wisp-server-node";
|
|
import { wispOptions } from "./serverFactory";
|
|
|
|
export const wispPlugin = {
|
|
name: "vite-plugin-wisp",
|
|
configureServer(server) {
|
|
server.wisp = wisp;
|
|
server.httpServer?.on("upgrade", (req, socket: Socket, head) =>
|
|
req.url?.endsWith("/wisp/")
|
|
? wisp.routeRequest(req, socket, head, wispOptions)
|
|
: undefined
|
|
);
|
|
}
|
|
};
|