websocket-sharp
websocket-sharp copied to clipboard
[ERROR] A session instance cannot be reused
Every time a client disconnects and tries to reconnect it keeps throwing this error. I tried KeepClean and ReuseAddress but still throws the error. What can I do to give clients the option to reconnect ? Thanks in advance.
After set ReuseAddress=True, I can reconnect or multi-connect the server. Maybe you need provide more info.
Which way are you using to add service?
- public void AddWebSocketService<TBehaviorWithNew>(string path, Action<TBehaviorWithNew> initializer) where TBehaviorWithNew : WebSocketBehavior, new();
- public void AddWebSocketService<TBehaviorWithNew>(string path) where TBehaviorWithNew : WebSocketBehavior, new();
- public void AddWebSocketService<TBehavior>(string path, Func<TBehavior> creator) where TBehavior : WebSocketBehavior;
I'm having this same issue with ReuseAddress = True.
Using public void AddWebSocketService(string path, Func creator) where TBehavior : WebSocketBehavior; to add the service.
Would like to add that I am using dotnet core 3.1
Were you able to fix this? I am running into the same issue and have no idea how to fix it. I have tried ReuseAddress and KeepClean. None of them worked. I even tried doing Sessions.Close(ID). I dumped the sessions and there are none but it still complains about the re-use... The exact message is: WebSocketServer.processRequest|A session instance cannot be reused.
Worst part, I cant figure out where its coming from because there is no exception I can catch...