Closed AugustinMauroy closed 2 months ago
The second parameter passed to the SOCKET
function is an IncomingMessage
object from the Node.js http
module. You can use that to get everything related to the request including the URL.
Ok ! Thanks but why do you think about having something like that:
export function SOCKET({
client: import('ws').WebSocket,
request: import('http').IncomingMessage,
server: import('ws').WebSocketServer,
params: YourParamsType
}) {
// ...
}
So parameter of function is one object. Like Get methods of next
@apteryxxyz dyamic path routes are not working using next-ws, it throws 'could not find module for page /api/socket/history' this is in path /api/socket/[api_type]/route.ts file, it doesnt read this path
@apteryxxyz dyamic path routes are not working using next-ws, it throws 'could not find module for page /api/socket/history' this is in path /api/socket/[api_type]/route.ts file, it doesnt read this path
Fixed in next-ws@1.1.1
.
Speaking of this issue, I'm gonna go ahead and close it, you can get the params from the request parameter. I want to avoid adding more parameters to the SOCKET function, and I'm not even sure if next-ws can access the names of dynamic segments.
I thinks everytings is on title