Open babizhu opened 7 months ago
If you are using Windows. I think the easiest way is using Fiddler. Fiddler is a useful http & WS proxy tool to help us to debug 401 issue.
if you don't use Windows to develop apps or Fiddler is very hard for you, then you can put the server code to here? so that I can reproduce the issue?
Client code:
_socket = new SocketIOClient.SocketIO("http://localhost:9099", new SocketIOOptions { ExtraHeaders = new Dictionary<string, string> { { "token", "1234561" }, }, });
On the server side, the netty-socketio library is used. It has a verification method. Once the verification fails, it will return an HTTP response with the HTTP code 401 and close the connection. The code is roughly as follows:
HttpResponse res = new DefaultHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.UNAUTHORIZED); // Return a 401 channel.writeAndFlush(res).addListener(ChannelFutureListener.CLOSE); // Close the connection
I also don't receive any messages in the OnError method.
The problem now is that I cannot get this 401. In other words, I cannot know that the reason for the connection closing is a verification failure. In this case, I will still try to reconnect.
client version 3.1.1
thanks