Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I find out if the verification failed? #348

Open
babizhu opened this issue Dec 15, 2023 · 1 comment
Open

How can I find out if the verification failed? #348

babizhu opened this issue Dec 15, 2023 · 1 comment

Comments

@babizhu
Copy link

babizhu commented Dec 15, 2023

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

@doghappy
Copy link
Owner

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants