Client close with no error

May 4, 2013 at 6:30 PM
Hi,
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;
                client.Query<ConCResponse>(CommandKeys.CONNECT_CLIENT,
                    new ConCRequest
                    {
                        UserID = this.userID,
                    }, (r) => HandleConnCResponse(r, ClientToken_textBox));
            };
WHYYYYY?
Coordinator
May 6, 2013 at 4: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 5: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
{
SUCCESS = 0,
ALREADYCONNECT = 1,
INVALID_ARGUMENTS,
TIMEOUT,
UNKOWN_ERROR,
};

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).Binaries.zip" than the one in the superwebsocket references folder, I start get different exception in the socket error callback : "DeserializeObject exception"
May 12, 2013 at 6: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:
https://websocket4net.codeplex.com/SourceControl/latest#WebSocket4Net/JsonWebSocket.JsonNet.cs

I think your problem is here."

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