- Home /
Question by
vivek_kamrej1 · Jun 19, 2019 at 05:28 AM ·
multiplayer-networkingsocket
How to get string as a response of socket !?
public void TestResponse(SocketIOEvent e)
{
Debug.Log(e);
socketState = SocketState.Running;
string str = AESDecrypt(e.data.GetField("data").ToString(), ENCKEY, ENCIV);
JSONObject jSONObject = new JSONObject(str);
print("<color=blue>RECEIVE : </color>" + jSONObject.Print());
if (OnSocketResponse != null)
{
Debug.Log("<color=blue> OnSocketResponse </color>");
OnSocketResponse(jSONObject);
}
}
I use this logic for get response but when i get response as a string then i got socket error and then disconnected
Comment
Is OnSocketResponse using a JSONObject as parameter or a string? Coz jSONObject is not a string object, you'd have to use jSONObject.ToString() or whatever is implemented to convert the JSONObject into a string object representing the JSON.
Your answer

Follow this Question
Related Questions
Multiplayer with sockets 1 Answer
How to set namespace in packet of socketIO using unity3d 1 Answer
Socket programming in unity 3 Answers
IOS socket connection to java socket server 0 Answers
Using mono socket with IPv6 and TCP 1 Answer