Testing next-ws

This commit is contained in:
2026-02-09 13:04:14 +01:00
parent 999980093a
commit 07156ec598
3 changed files with 1180 additions and 11 deletions
+1161 -7
View File
File diff suppressed because it is too large Load Diff
+5 -4
View File
@@ -3,10 +3,10 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "npm run buildserver && node ./.next/server.js", "dev": "next dev --turbopack",
"build": "npm run buildserver && next build", "build": "npm run build:lib && next build",
"start": "npm run buildserver && NODE_ENV=production node ./.next/server.js", "postinstall": "npm run ws -- -y",
"buildserver": "tsc -p server.tsconfig.json" "ws": "npx --yes next-ws-cli@latest patch"
}, },
"dependencies": { "dependencies": {
"@codemirror/lang-go": "^6.0.1", "@codemirror/lang-go": "^6.0.1",
@@ -56,6 +56,7 @@
"ioredis": "^5.9.2", "ioredis": "^5.9.2",
"lucide-react": "^0.563.0", "lucide-react": "^0.563.0",
"next": "16.1.6", "next": "16.1.6",
"next-ws": "^2.1.16",
"radix-ui": "^1.4.3", "radix-ui": "^1.4.3",
"react": "19.2.3", "react": "19.2.3",
"react-day-picker": "^9.13.0", "react-day-picker": "^9.13.0",
+14
View File
@@ -0,0 +1,14 @@
import { WebSocketServer, WebSocket } from "ws";
export function UPGRADE(client: WebSocket, server: WebSocketServer) {
console.log("A client connected");
client.on("message", (message) => {
console.log("Received message:", message);
client.send(message);
});
client.once("close", () => {
console.log("A client disconnected");
});
}