This project is read-only.

Client close with no error

May 4, 2013 at 7:30 PM
I'm trying to move to new version, I make all the changes, and all compiled well.
But when I run the test app, and call a command (Connect), once server send respond, the client close (in debug, can't see anything), when run test from binarry I get app exit!!! why?

the server was sending :
SendJsonResponse(session, new ConCResponse
                StatusCode = ResponseCode.SUCCESS,
                Token = session.SessionID
now I changes it to:
            SendJsonMessage(session, new ConCResponse
                StatusCode = ResponseCode.SUCCESS,
                Token = session.SessionID
Once server call "SendJsonMessage" client closed.

client side:
  m_ClientWebSocket.Opened += (s, e) =>
                var client = s as JsonWebSocket;
                    new ConCRequest
                        UserID = this.userID,
                    }, (r) => HandleConnCResponse(r, ClientToken_textBox));
May 6, 2013 at 5:05 PM
Could you try try to catch the unhandled exception in the client side?

AppDomain.CurrentDomain.UnhandledException += (s, e) =>
//logging the exception
May 12, 2013 at 6:17 PM
after replace again the DLL's the exception "DeserializeObject exception" not happen again.

The the unhandle exception that cause the app to close is:
ExceptionObject = {"Invalid cast from 'System.Int64' to 'WebSocketServer.Shared.ResponseCode'."}

why the hill this, I compile all as AnyCPU the RespondCode is:
public enum ResponseCode : int

socket4net .dll is x64, and seems like mix between x64&x86 compilation :(

After replace the dll websocket4net by using the one in the "WebSocket4Net(0.8)" than the one in the superwebsocket references folder, I start get different exception in the socket error callback : "DeserializeObject exception"
May 12, 2013 at 7:50 PM
Kerry wrote:
"If you meet a JSON serializing/deserializing problem, you can overwrite the two method of JsonWebSocket below to change back to use JSON.NET:
protected virtual string SerializeObject(object target)
protected virtual object DeserializeObject(string json, Type type)

Similar with this file:

I think your problem is here."

It solved the problem, seems like I missed the fact you remove Newtonsoft.Json.dll to reduce size.