You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a middleware that returns an Error object in some particular situation. I see the error in the server's console but I do not see the error being sent to the client.
import{Event,Socket}from"socket.io";import{ServiceLayer}from"../services/serviceLayer";exportconstuserActivateMiddleware=(serviceLayer: ServiceLayer,socket: Socket)=>async(event: Event,next: (err?: Error)=>void)=>{constuser=socket.data.user;if(user===undefined){returnnext(newError("User Email Not validated"));}returnnext();};// Elsewhere:socket.use(userActivateMiddleware(serviceLayer,socket));
Socket.IO client version: 4.5.0
Client
import{io}from"socket.io-client";// Listenerssocket.on("connect_error",socketConnectError);socket.on("error",socketError);functionsocketError(err: any): void{console.log("Socket Error",err);}functionsocketConnectError(error: Error): void{console.log("socketConnectError",error);}// How the request startssocket.emit(MsgUserPixelKind,message,(response: MsgUserPixelValidation)=>{manageResponseFromMsgUserPixel(response);});
Expected behavior
The emit is performed and the NodeJS Socket.io servers receive the request. I can set a breakpoint and see the request getting inside the middleware. In the case I am testing, a rejection, I see the code getting into the if and executing the return next(new Error("....."));. I am expected to get the client to be notified somehow (by the connect_error or error or by the callback. However, nothing.
Platform:
Device: Macbook Pro
OS: MacOS 12.1
Additional context
Looking at the Chrome's network ws tab, I see the request sent which collaborate that I can have the NodeJS server hit my breakpoint. However, no response. The callback is not called either.
The text was updated successfully, but these errors were encountered:
Describe the bug
I have a middleware that returns an Error object in some particular situation. I see the error in the server's console but I do not see the error being sent to the client.
Server:
"socket.io": "^4.5.0"
Client:
"socket.io-client": "^4.5.0"
To Reproduce
Socket.IO server version:
x4.5.0
Server
Socket.IO client version:
4.5.0
Client
Expected behavior
The
emit
is performed and the NodeJS Socket.io servers receive the request. I can set a breakpoint and see the request getting inside the middleware. In the case I am testing, a rejection, I see the code getting into theif
and executing thereturn next(new Error("....."));
. I am expected to get the client to be notified somehow (by theconnect_error
orerror
or by the callback. However, nothing.Platform:
Additional context
Looking at the Chrome's network
ws
tab, I see the request sent which collaborate that I can have the NodeJS server hit my breakpoint. However, no response. The callback is not called either.The text was updated successfully, but these errors were encountered: