graphql/yoga-server/docs/integrations/integration-with-nextjs #2444
Replies: 2 comments 5 replies
-
Thank you very much for the example using the custom server for websockets. It's working for me until it comes to session authentication with next-auth. I am not quite sure how to get a hold of the session inside context. When I try to turn that on inside the context function...
... I get the following error
Any pointers are much appreciated!:) |
Beta Was this translation helpful? Give feedback.
-
I have a second topic that I want to discuss for the graphql-yoga custom server solution. My Hot Module Replacement stopped working. In the solution that I had in place previously I would do this: res.socket.server.ws ||= (() => {
res.socket.server.on(
'upgrade',
function (request: IncomingMessage, socket: Socket, head) {
const { pathname } = parse(request.url ?? '')
if (pathname === '/api/graphql') {
wsServer.handleUpgrade(request, socket, head, function (ws) {
wsServer.emit('connection', ws)
})
} else if (pathname === '/_next/webpack-hmr') {
// Do nothing
} else {
socket.destroy()
}
}
)
serverCleanup = useServer<ConnectionParams>({ schema, context }, wsServer)
return wsServer
})() What would be the equivalent in this example to bring back HMR? |
Beta Was this translation helpful? Give feedback.
-
graphql/yoga-server/docs/integrations/integration-with-nextjs
GraphQL Yoga Documentation
https://the-guild.dev/graphql/yoga-server/docs/integrations/integration-with-nextjs
Beta Was this translation helpful? Give feedback.
All reactions