Moving to SuperWebSocket(0.7) respond issue

May 12, 2013 at 7:08 PM
Hi,

After I move from version 6 to 7, and after make some modification to fit the changes, and after override the serialize/deserialize json functions (in websocket4net), connect successfully works, and I get correct respond status and token from server.

But now, I face another issue, commands wait for respond but it not arrive (client send command to server, server get the command process it and "send" respond), the server respond not arrive to client :( - (no error in any side, server error log is empty)

using previous version , After each command done, I was send respond to client to let them know server is free to get next command, I was using:
            SendJsonResponse(session, "CMNDR", null);
now seems like null not been handled (Exception:Object reference not set to an instance of an object.)!!!, so I change it to the following:
SendJsonMessage(session,  "CMNDR",  new CommonResponse
            {
                StatusCode = ResponseCode.SUCCESS
            });
No error, server seems to send without any issue, but in client, No respond arrive!!!!!!

the on respond defined as following (didnt change anything from prev version)
//JsonWebSocket m_ServerWebSocket

m_ServerWebSocket.On<CommonResponse>("CMNDR", this.OnCommonRespondMessage);

public void OnCommonRespondMessage(CommonResponse m)
{
   lock (lockOnCommonRespond)
  {
     mCommandResponceSignal.Set();
   }
 }
Do I miss anything again?
May 15, 2013 at 5:14 AM
:(
Coordinator
May 15, 2013 at 2:22 PM
You can debug into the code easily, websocket4net is open source.

BTW, if you just want to send a string "CMNDR" to client, use Send method directly, don't use SendJsonMessage because what you are sending is not a JSON message.
May 16, 2013 at 2:36 AM
I do tried send before, but same result:

session.Send("CMNDR" + " " + JsonConvert.SerializeObject(new CommonResponse
        {
            StatusCode = ResponseCode.SUCCESS
        }));
May 16, 2013 at 2:54 AM
Sorry this works:
session.Send("CMNDR " + JsonConvert.SerializeObject(new CommonResponse
            {
                StatusCode = ResponseCode.SUCCESS
            }));  
But this not WORK at all:
            session.Send(CommandKeys.COMMAND_DONE_RESPOND ,new CommonResponse
            {
                StatusCode = ResponseCode.SUCCESS
            });  
mean the new binary support will not work!!!!, why Object not work?
Coordinator
May 16, 2013 at 3:40 AM
Edited May 16, 2013 at 3:40 AM
If you just want to send a string "CMNDR" to client, use Send method directly, don't use SendJsonMessage because what you are sending is not a JSON message.

You haven;t understand me completely:

session.Send("CMNDR");
May 16, 2013 at 3:46 AM
I understand exactly what you wrote, what I'm saying is: sending an object not work!!!
sending string is not what I need, if i'll send only string, this useless, since object or binarry will not work, which is what I need,
Coordinator
May 16, 2013 at 4:05 AM
If so, how my test cases in the Test project can pass?

Please debug into the code check the real details.