You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to run the connection Demo, then meet a problem:
ArgumentException: JSON parse error: The document root must not follow by other values.
the json data revived like this: {"sid":"eADGfUhZX4r8EixPAAAB","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000}2:40
so I change the code in class SocketInitializer from: var textIndex = www.text.IndexOf('{'); if (textIndex != -1) { var json = www.text.Substring(textIndex); var answer = JsonUtility.FromJson<PollingUrlAnswer>(json); _urlQueries.Add("sid", answer.sid); }
to var textIndex = www.text.IndexOf('{'); if (textIndex != -1) { int lastIndex = www.text.LastIndexOf('}'); int length = lastIndex - textIndex + 1; var json = www.text.Substring(textIndex, length); var answer = JsonUtility.FromJson<PollingUrlAnswer>(json); _urlQueries.Add("sid", answer.sid); }
then the problem has been solved
The text was updated successfully, but these errors were encountered:
@dxd39 I think that you're running the server on Socket.IO V2 which is not supported yet. Please check your Socket.IO version and downgrade V1 if possible~
I tried to run the connection Demo, then meet a problem:
ArgumentException: JSON parse error: The document root must not follow by other values.
the json data revived like this: {"sid":"eADGfUhZX4r8EixPAAAB","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000}2:40
so I change the code in class SocketInitializer from:
var textIndex = www.text.IndexOf('{'); if (textIndex != -1) { var json = www.text.Substring(textIndex); var answer = JsonUtility.FromJson<PollingUrlAnswer>(json); _urlQueries.Add("sid", answer.sid); }
to
var textIndex = www.text.IndexOf('{'); if (textIndex != -1) { int lastIndex = www.text.LastIndexOf('}'); int length = lastIndex - textIndex + 1; var json = www.text.Substring(textIndex, length); var answer = JsonUtility.FromJson<PollingUrlAnswer>(json); _urlQueries.Add("sid", answer.sid); }
then the problem has been solved
The text was updated successfully, but these errors were encountered: