Moving peer.ctx to peer._internal broke the Nuxt socket.io implementation #38
-
After unjs/crossws#59 was merged, the Nuxt 3 example of the socket.io implementation does no longer work in production. They have updated their example to use My question: is there a preferred way of handling this, or maybe someone with more insight can spot the issue or fix? The complete nuxt example can be found here. websocket: {
open(peer) {
// crossws >= 0.3.0
// @ts-expect-error private method and property
engine.prepare(peer._internal.nodeReq); // ❌ Does not work in production
// @ts-expect-error private method and property
engine.onWebSocket(peer._internal.nodeReq, peer._internal.nodeReq.socket, peer.websocket); // ❌ does not work in production
// crossws < 0.3.0
// const context = peer.ctx.node;
// // @ts-expect-error private method
// engine.prepare(context.req);
// // @ts-expect-error private method
// engine.onWebSocket(context.req, context.req.socket, context.ws);
}
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The issue was fixed by the latest nuxt release, which upgraded nitropack to the 2.10 version which also uses crossws >=0.3 🥳 |
Beta Was this translation helpful? Give feedback.
The issue was fixed by the latest nuxt release, which upgraded nitropack to the 2.10 version which also uses crossws >=0.3 🥳