diff --git a/.gitignore b/.gitignore index 9537b8a9..437e90b4 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ *.usertasks .DS_Store .vs/ +.idea/ #Mono Project Files *.pidb diff --git a/README.md b/README.md new file mode 100644 index 00000000..5ebdc904 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Synthesis Fork of Colyseus-Unity-SDK + +**When updating this fork, in order to make your changes bubble up to games consuming this package, you must do the following in each game:** + +1. In the `manifest.json` file of each game, remove the line for this package `"com.gosynthschool.io.colyseus.sdk": "https://github.com/gosynthschool/colyseus-unity-sdk.git#synthesis-changes",`. +2. Give the Unity Editor focus and let it refresh packages. +3. In the `manifest.json` file, add the line you removed for this package in step 1 back. +4. Give Unity Editor focus and let it refresh packages. +5. You should see the `client/simName/Packages/packages-lock.json` file has updated with a new commit hash for this package. \ No newline at end of file diff --git a/README.md.meta b/README.md.meta new file mode 100644 index 00000000..3b0a0dbb --- /dev/null +++ b/README.md.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 77ab74859c46ef14e9766df2cb1a5726 +TextScriptImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Scripts/ColyseusRequest.cs b/Runtime/Scripts/ColyseusRequest.cs index df9f522f..959c354e 100644 --- a/Runtime/Scripts/ColyseusRequest.cs +++ b/Runtime/Scripts/ColyseusRequest.cs @@ -35,17 +35,17 @@ public async Task Request(string uriMethod, string uriPath, string uriQu { req.uploadHandler = data; } - + foreach (KeyValuePair pair in _serverSettings.HeadersDictionary) { req.SetRequestHeader(pair.Key, pair.Value); } - + if (!string.IsNullOrEmpty(Token)) { req.SetRequestHeader("Authorization", "Bearer " + Token); } - + // req.uploadHandler = new UploadHandlerRaw(bytes); req.downloadHandler = new DownloadHandlerBuffer(); await req.SendWebRequest(); @@ -58,19 +58,17 @@ public async Task Request(string uriMethod, string uriPath, string uriQu { if (_serverSettings.useSecureProtocol) { - //We failed to make this call with a secure protocol, try with non-secure and if that works we'll stick with it - _serverSettings.useSecureProtocol = false; - LSLog.LogError($"Failed to make request to {req.url} with secure protocol, trying again without!"); - return await Request(uriMethod, uriPath, uriQuery, Token, data); + //We failed to make this call with a secure protocol + LSLog.LogError($"Failed to make request to {req.url}."); } else { throw new Exception(req.error); } } - + string json = req.downloadHandler.text; - + return json; } ; } @@ -87,18 +85,18 @@ public async Task Request(string uriMethod, string uriPath, Dictionary pair in _serverSettings.HeadersDictionary) { req.SetRequestHeader(pair.Key, pair.Value); } - + if (headers != null) { foreach (KeyValuePair header in headers) @@ -106,7 +104,7 @@ public async Task Request(string uriMethod, string uriPath, Dictionary Request(string uriMethod, string uriPath, Dictionary