We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expected working example:
import { NextApiHandler } from "next"; import { NextWebSocketHandler } from "next-plugin-websocket"; export const socket: NextWebSocketHandler = (client, req) => { console.log("Client connected"); client.on("message", (msg) => { client.send(msg); }); client.on("close", () => { console.log("Client disconnected"); }); }; export async function GET(request: Request) { return new Response("Upgrade Required", { status: 426, }); }
After PR #6 has been merged it will give an error if you try and use the above example.
error - unhandledRejection: PageNotFoundError: Cannot find module for page: /api/ws at findPagePathData (.../node_modules/next/dist/server/dev/on-demand-entry-handler.js:272:15) at async Object.ensurePage (.../node_modules/next/dist/server/dev/on-demand-entry-handler.js:444:38) at async Server.<anonymous> (.../node_modules/next-plugin-websocket/dist/index.js:88:13) { code: 'ENOENT' }
It only works with the old pages directory.
The text was updated successfully, but these errors were encountered:
I tried get my self a deeper understanding of how this would work with the new app dir in 13.3.
Even if you find and require the route file socket never gets exported.
May need to find a different approach here.
Sorry, something went wrong.
No branches or pull requests
Expected working example:
After PR #6 has been merged it will give an error if you try and use the above example.
It only works with the old pages directory.
The text was updated successfully, but these errors were encountered: