nhn / socket.io-client-unity3d

socket.io-Client for Unity3D, which is compatible with socket.io v1.x
Other
167 stars 43 forks source link

ArgumentException: JSON parse error: The document root must not follow by other values. #38

Open Zeon8 opened 5 years ago

Zeon8 commented 5 years ago

I paste code from wiki https://github.com/nhn/socket.io-client-unity3d/wiki/Sample#2-acks-message and run nodejs server and run unity client and in log this error: ArgumentException: JSON parse error: The document root must not follow by other values. UnityEngine.JsonUtility.FromJson (System.String json, System.Type type) (at C:/buildslave/unity/build/Modules/JSONSerialize/Public/JsonUtility.bindings.cs:50) UnityEngine.JsonUtility.FromJson[T] (System.String json) (at C:/buildslave/unity/build/Modules/JSONSerialize/Public/JsonUtility.bindings.cs:33) socket.io.SocketInitializer+d__21.MoveNext () (at Assets/Plugins/socket.io/SocketInitializer.cs:138) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17

My Laptop: Intel Pentium 2020m 4 GB RAM Intel® HD Graphics for 3rd Generation Intel® Processors

sandichhuu commented 4 years ago

Hi, i'm also face this error. Here is my way to fix this:

image

iglikoxha commented 4 years ago

You should use an older version of socket.io specifically 1.7.4 the latest 1.x version