├── .editorconfig ├── .github ├── FUNDING.yml └── workflows │ └── upmsemver.yml ├── .gitignore ├── LICENSE ├── Media ├── README.txt └── header.png ├── NativeWebSocket ├── Assets │ ├── Samples~ │ │ └── WebSocketExample │ │ │ ├── Connection.cs │ │ │ ├── Connection.cs.meta │ │ │ ├── WebSocketExampleScene.unity │ │ │ └── WebSocketExampleScene.unity.meta │ ├── WebSocket.meta │ ├── WebSocket │ │ ├── WebSocket.cs │ │ ├── WebSocket.cs.meta │ │ ├── WebSocket.jslib │ │ ├── WebSocket.jslib.meta │ │ ├── endel.nativewebsocket.asmdef │ │ └── endel.nativewebsocket.asmdef.meta │ ├── WebSocketExample.meta │ ├── package.json │ └── package.json.meta ├── Packages │ └── manifest.json └── ProjectSettings │ ├── AudioManager.asset │ ├── ClusterInputManager.asset │ ├── DynamicsManager.asset │ ├── EditorBuildSettings.asset │ ├── EditorSettings.asset │ ├── GraphicsSettings.asset │ ├── InputManager.asset │ ├── NavMeshAreas.asset │ ├── Physics2DSettings.asset │ ├── PresetManager.asset │ ├── ProjectSettings.asset │ ├── ProjectVersion.txt │ ├── QualitySettings.asset │ ├── TagManager.asset │ ├── TimeManager.asset │ ├── UnityConnectSettings.asset │ ├── VFXManager.asset │ └── XRSettings.asset ├── NodeServer ├── index.js ├── package-lock.json └── package.json └── README.md /.editorconfig: -------------------------------------------------------------------------------- 1 | [*] 2 | end_of_line = lf 3 | charset = utf-8 4 | trim_trailing_whitespace = true 5 | indent_style = space 6 | indent_size = 2 7 | 8 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: endel # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: endel # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: endeld # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | custom: https://www.paypal.me/endeld # Replace with a single custom sponsorship URL 9 | -------------------------------------------------------------------------------- /.github/workflows/upmsemver.yml: -------------------------------------------------------------------------------- 1 | name: Update Unity UPM semantic versioning 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | checkSemver: 10 | name: Check for Semver Change 11 | runs-on: ubuntu-latest 12 | outputs: 13 | semver-updated: ${{ steps.check.outputs.changed }} 14 | steps: 15 | - name: Checkout Code 16 | uses: actions/checkout@v2 17 | - uses: EndBug/version-check@v1 18 | id: check 19 | with: 20 | file-name: NativeWebSocket/Assets/package.json 21 | diff-search: true 22 | token: ${{ secrets.GITHUB_TOKEN }} 23 | - name: Log when changed 24 | if: steps.check.outputs.changed == 'true' 25 | run: 'echo "Version change found in commit ${{ steps.check.outputs.commit }}! New version: ${{ steps.check.outputs.version }} (${{ steps.check.outputs.type }})"' 26 | updateUPM: 27 | name: Update UPM branch 28 | runs-on: ubuntu-latest 29 | needs: [checkSemver] 30 | if: needs.checkSemver.outputs.semver-updated == 'true' 31 | steps: 32 | # Copy correct directory into upm branch 33 | - uses: actions/checkout@v2 34 | 35 | - name: Push package directory to subtree 36 | uses: s0/git-publish-subdir-action@develop 37 | env: 38 | REPO: self 39 | BRANCH: upm 40 | FOLDER: NativeWebSocket/Assets/ 41 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 42 | createPackage: 43 | name: Create Unity Package and Release 44 | runs-on: ubuntu-latest 45 | needs: [checkSemver] 46 | if: needs.checkSemver.outputs.semver-updated == 'true' 47 | steps: 48 | - name: Checkout Code 49 | uses: actions/checkout@v2 50 | - name: Gather files 51 | run: | 52 | echo "NativeWebSocket/Assets/WebSocket.meta" > metaList 53 | find NativeWebSocket/Assets/WebSocket/ -name \*.meta >> metaList 54 | - name: Extract Version 55 | id: version 56 | uses: notiz-dev/github-action-json-property@release 57 | with: 58 | path: 'NativeWebSocket/Assets/package.json' 59 | prop_path: 'version' 60 | - run: echo ${{steps.version.outputs.prop}} 61 | - name: Create Directory 62 | run: mkdir Release 63 | - name: Generate Unity Package 64 | id: build-package 65 | uses: pCYSl5EDgo/create-unitypackage@master 66 | with: 67 | package-path: 'NativeWebSocket.unitypackage' 68 | include-files: metaList 69 | - name: Upload Package 70 | uses: actions/upload-artifact@master 71 | with: 72 | path: ./NativeWebSocket.unitypackage 73 | name: NativeWebSocket 74 | - name: Changelog 75 | uses: scottbrenner/generate-changelog-action@master 76 | id: Changelog 77 | - name: Create Release 78 | id: create_release 79 | uses: actions/create-release@v1 80 | env: 81 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 82 | with: 83 | tag_name: ${{ steps.version.outputs.prop }} 84 | release_name: ${{ steps.version.outputs.prop }} 85 | body: | 86 | ${{ steps.Changelog.outputs.changelog }} 87 | draft: false 88 | prerelease: true 89 | - name: Upload Release Asset 90 | id: upload-release-asset 91 | uses: actions/upload-release-asset@v1 92 | env: 93 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 94 | with: 95 | upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps 96 | asset_path: ./NativeWebSocket.unitypackage 97 | asset_name: NativeWebSocket.unitypackage 98 | asset_content_type: application/x-gzip 99 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | 4 | # This .gitignore file should be placed at the root of your Unity project directory 5 | # 6 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore 7 | # 8 | [Ll]ibrary/ 9 | [Tt]emp/ 10 | [Oo]bj/ 11 | [Bb]uild/ 12 | [Bb]uilds/ 13 | [Ll]ogs/ 14 | [Mm]emoryCaptures/ 15 | 16 | # Never ignore Asset meta data 17 | ![Aa]ssets/**/*.meta 18 | 19 | # Uncomment this line if you wish to ignore the asset store tools plugin 20 | # /[Aa]ssets/AssetStoreTools* 21 | 22 | # Autogenerated Jetbrains Rider plugin 23 | [Aa]ssets/Plugins/Editor/JetBrains* 24 | 25 | # Visual Studio cache directory 26 | .vs/ 27 | 28 | # Gradle cache directory 29 | .gradle/ 30 | 31 | # Autogenerated VS/MD/Consulo solution and project files 32 | ExportedObj/ 33 | .consulo/ 34 | *.csproj 35 | *.unityproj 36 | *.sln 37 | *.suo 38 | *.tmp 39 | *.user 40 | *.userprefs 41 | *.pidb 42 | *.booproj 43 | *.svd 44 | *.pdb 45 | *.mdb 46 | *.opendb 47 | *.VC.db 48 | 49 | # Unity3D generated meta files 50 | *.pidb.meta 51 | *.pdb.meta 52 | *.mdb.meta 53 | 54 | # Unity3D generated file on crash reports 55 | sysinfo.txt 56 | 57 | # Builds 58 | *.apk 59 | *.unitypackage 60 | 61 | # Crashlytics generated file 62 | crashlytics-build.properties 63 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2019 Endel Dreyer 2 | Copyright 2018 Jiri Hybek 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | 16 | -------------------------------------------------------------------------------- /Media/README.txt: -------------------------------------------------------------------------------- 1 | Native WebSocket Client! 2 | ------------------------ 3 | 4 | This is the simplest and easiest WebSocket library for Unity you can find! 5 | No external DLL's required, supports all major build targets, including WebGL / HTML5. 6 | 7 | For the usage example, check out the "WebSocketExample" folder. It contains a 8 | "Connection.cs" script file, demonstrating the entire API of the Native 9 | WebSocket Client. You can attach it as a script component to any object in your 10 | scene for testing. 11 | 12 | This package basically provides a "NativeWebSocket.WebSocket" class, which has 13 | these public methods: 14 | 15 | - new WebSocket(string url) 16 | The WebSocket constructor. Use the URL of your WebSocket server as argument. 17 | 18 | - websocket.Send(byte[] bytes) 19 | Sends a binary message to the server. 20 | 21 | - websocket.SendText(string message) 22 | Sends a text message to the server. 23 | 24 | - websocket.OnMessage += (byte[] bytes) => {} 25 | An event that triggers whenever a message comes from the server. To parse string 26 | messages, use "System.Text.Encoding.UTF8.GetString(bytes)" 27 | 28 | - websocket.OnOpen += () => {} 29 | An event that triggers whenever a connection has been sucessfully established. 30 | 31 | - websocket.OnClose += (int code) => {} 32 | An event that triggers whenever an error occurs with the connection. 33 | 34 | - websocket.OnError += (string message) => {} 35 | An event that triggers whenever an error occurs with the connection. 36 | 37 | - websocket.Connect() 38 | Connects into the WebSocket server. 39 | 40 | - websocket.Close() 41 | Force to close the WebSocket connection with the server. Make sure to call 42 | websocket.Close() when quitting your application (OnApplicationQuit). 43 | 44 | - websocket.State 45 | Contains the current state of the WebSocket connection. Can be one of: 46 | WebSocketState.Connecting, WebSocketState.Open, WebSocketState.Closing, 47 | WebSocketState.Closed. 48 | 49 | -------------------------------------------------------------------------------- /Media/header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/endel/NativeWebSocket/6f407654e5a3cc15e53c5f2b4beede71c35582a0/Media/header.png -------------------------------------------------------------------------------- /NativeWebSocket/Assets/Samples~/WebSocketExample/Connection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using UnityEngine; 5 | 6 | using NativeWebSocket; 7 | 8 | public class Connection : MonoBehaviour 9 | { 10 | WebSocket websocket; 11 | 12 | // Start is called before the first frame update 13 | async void Start() 14 | { 15 | // websocket = new WebSocket("ws://echo.websocket.org"); 16 | websocket = new WebSocket("ws://localhost:3000"); 17 | 18 | websocket.OnOpen += () => 19 | { 20 | Debug.Log("Connection open!"); 21 | }; 22 | 23 | websocket.OnError += (e) => 24 | { 25 | Debug.Log("Error! " + e); 26 | }; 27 | 28 | websocket.OnClose += (e) => 29 | { 30 | Debug.Log("Connection closed!"); 31 | }; 32 | 33 | websocket.OnMessage += (bytes) => 34 | { 35 | // Reading a plain text message 36 | var message = System.Text.Encoding.UTF8.GetString(bytes); 37 | Debug.Log("Received OnMessage! (" + bytes.Length + " bytes) " + message); 38 | }; 39 | 40 | // Keep sending messages at every 0.3s 41 | InvokeRepeating("SendWebSocketMessage", 0.0f, 0.3f); 42 | 43 | await websocket.Connect(); 44 | } 45 | 46 | void Update() 47 | { 48 | #if !UNITY_WEBGL || UNITY_EDITOR 49 | websocket.DispatchMessageQueue(); 50 | #endif 51 | } 52 | 53 | async void SendWebSocketMessage() 54 | { 55 | if (websocket.State == WebSocketState.Open) 56 | { 57 | // Sending bytes 58 | await websocket.Send(new byte[] { 10, 20, 30 }); 59 | 60 | // Sending plain text 61 | await websocket.SendText("plain text message"); 62 | } 63 | } 64 | 65 | private async void OnApplicationQuit() 66 | { 67 | await websocket.Close(); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /NativeWebSocket/Assets/Samples~/WebSocketExample/Connection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f451fab1e6d94aea8fb73803e281bb3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /NativeWebSocket/Assets/Samples~/WebSocketExample/WebSocketExampleScene.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 705507994} 41 | m_IndirectSpecularColor: {r: 0.44657868, g: 0.49641263, b: 0.57481706, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 11 47 | m_GIWorkflowMode: 0 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 1 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 500 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 2 83 | m_PVRDenoiserTypeDirect: 0 84 | m_PVRDenoiserTypeIndirect: 0 85 | m_PVRDenoiserTypeAO: 0 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 0 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightingDataAsset: {fileID: 0} 100 | m_UseShadowmask: 1 101 | --- !u!196 &4 102 | NavMeshSettings: 103 | serializedVersion: 2 104 | m_ObjectHideFlags: 0 105 | m_BuildSettings: 106 | serializedVersion: 2 107 | agentTypeID: 0 108 | agentRadius: 0.5 109 | agentHeight: 2 110 | agentSlope: 45 111 | agentClimb: 0.4 112 | ledgeDropHeight: 0 113 | maxJumpAcrossDistance: 0 114 | minRegionArea: 2 115 | manualCellSize: 0 116 | cellSize: 0.16666667 117 | manualTileSize: 0 118 | tileSize: 256 119 | accuratePlacement: 0 120 | debug: 121 | m_Flags: 0 122 | m_NavMeshData: {fileID: 0} 123 | --- !u!1 &705507993 124 | GameObject: 125 | m_ObjectHideFlags: 0 126 | m_CorrespondingSourceObject: {fileID: 0} 127 | m_PrefabInstance: {fileID: 0} 128 | m_PrefabAsset: {fileID: 0} 129 | serializedVersion: 6 130 | m_Component: 131 | - component: {fileID: 705507995} 132 | - component: {fileID: 705507994} 133 | m_Layer: 0 134 | m_Name: Directional Light 135 | m_TagString: Untagged 136 | m_Icon: {fileID: 0} 137 | m_NavMeshLayer: 0 138 | m_StaticEditorFlags: 0 139 | m_IsActive: 1 140 | --- !u!108 &705507994 141 | Light: 142 | m_ObjectHideFlags: 0 143 | m_CorrespondingSourceObject: {fileID: 0} 144 | m_PrefabInstance: {fileID: 0} 145 | m_PrefabAsset: {fileID: 0} 146 | m_GameObject: {fileID: 705507993} 147 | m_Enabled: 1 148 | serializedVersion: 9 149 | m_Type: 1 150 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 151 | m_Intensity: 1 152 | m_Range: 10 153 | m_SpotAngle: 30 154 | m_InnerSpotAngle: 21.802082 155 | m_CookieSize: 10 156 | m_Shadows: 157 | m_Type: 2 158 | m_Resolution: -1 159 | m_CustomResolution: -1 160 | m_Strength: 1 161 | m_Bias: 0.05 162 | m_NormalBias: 0.4 163 | m_NearPlane: 0.2 164 | m_CullingMatrixOverride: 165 | e00: 1 166 | e01: 0 167 | e02: 0 168 | e03: 0 169 | e10: 0 170 | e11: 1 171 | e12: 0 172 | e13: 0 173 | e20: 0 174 | e21: 0 175 | e22: 1 176 | e23: 0 177 | e30: 0 178 | e31: 0 179 | e32: 0 180 | e33: 1 181 | m_UseCullingMatrixOverride: 0 182 | m_Cookie: {fileID: 0} 183 | m_DrawHalo: 0 184 | m_Flare: {fileID: 0} 185 | m_RenderMode: 0 186 | m_CullingMask: 187 | serializedVersion: 2 188 | m_Bits: 4294967295 189 | m_RenderingLayerMask: 1 190 | m_Lightmapping: 1 191 | m_LightShadowCasterMode: 0 192 | m_AreaSize: {x: 1, y: 1} 193 | m_BounceIntensity: 1 194 | m_ColorTemperature: 6570 195 | m_UseColorTemperature: 0 196 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} 197 | m_UseBoundingSphereOverride: 0 198 | m_ShadowRadius: 0 199 | m_ShadowAngle: 0 200 | --- !u!4 &705507995 201 | Transform: 202 | m_ObjectHideFlags: 0 203 | m_CorrespondingSourceObject: {fileID: 0} 204 | m_PrefabInstance: {fileID: 0} 205 | m_PrefabAsset: {fileID: 0} 206 | m_GameObject: {fileID: 705507993} 207 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 208 | m_LocalPosition: {x: 0, y: 3, z: 0} 209 | m_LocalScale: {x: 1, y: 1, z: 1} 210 | m_Children: [] 211 | m_Father: {fileID: 0} 212 | m_RootOrder: 1 213 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 214 | --- !u!1 &963194225 215 | GameObject: 216 | m_ObjectHideFlags: 0 217 | m_CorrespondingSourceObject: {fileID: 0} 218 | m_PrefabInstance: {fileID: 0} 219 | m_PrefabAsset: {fileID: 0} 220 | serializedVersion: 6 221 | m_Component: 222 | - component: {fileID: 963194228} 223 | - component: {fileID: 963194227} 224 | - component: {fileID: 963194226} 225 | - component: {fileID: 963194230} 226 | - component: {fileID: 963194229} 227 | m_Layer: 0 228 | m_Name: Main Camera 229 | m_TagString: MainCamera 230 | m_Icon: {fileID: 0} 231 | m_NavMeshLayer: 0 232 | m_StaticEditorFlags: 0 233 | m_IsActive: 1 234 | --- !u!81 &963194226 235 | AudioListener: 236 | m_ObjectHideFlags: 0 237 | m_CorrespondingSourceObject: {fileID: 0} 238 | m_PrefabInstance: {fileID: 0} 239 | m_PrefabAsset: {fileID: 0} 240 | m_GameObject: {fileID: 963194225} 241 | m_Enabled: 1 242 | --- !u!20 &963194227 243 | Camera: 244 | m_ObjectHideFlags: 0 245 | m_CorrespondingSourceObject: {fileID: 0} 246 | m_PrefabInstance: {fileID: 0} 247 | m_PrefabAsset: {fileID: 0} 248 | m_GameObject: {fileID: 963194225} 249 | m_Enabled: 1 250 | serializedVersion: 2 251 | m_ClearFlags: 1 252 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 253 | m_projectionMatrixMode: 1 254 | m_GateFitMode: 2 255 | m_FOVAxisMode: 0 256 | m_SensorSize: {x: 36, y: 24} 257 | m_LensShift: {x: 0, y: 0} 258 | m_FocalLength: 50 259 | m_NormalizedViewPortRect: 260 | serializedVersion: 2 261 | x: 0 262 | y: 0 263 | width: 1 264 | height: 1 265 | near clip plane: 0.3 266 | far clip plane: 1000 267 | field of view: 60 268 | orthographic: 0 269 | orthographic size: 5 270 | m_Depth: -1 271 | m_CullingMask: 272 | serializedVersion: 2 273 | m_Bits: 4294967295 274 | m_RenderingPath: -1 275 | m_TargetTexture: {fileID: 0} 276 | m_TargetDisplay: 0 277 | m_TargetEye: 3 278 | m_HDR: 1 279 | m_AllowMSAA: 1 280 | m_AllowDynamicResolution: 0 281 | m_ForceIntoRT: 0 282 | m_OcclusionCulling: 1 283 | m_StereoConvergence: 10 284 | m_StereoSeparation: 0.022 285 | --- !u!4 &963194228 286 | Transform: 287 | m_ObjectHideFlags: 0 288 | m_CorrespondingSourceObject: {fileID: 0} 289 | m_PrefabInstance: {fileID: 0} 290 | m_PrefabAsset: {fileID: 0} 291 | m_GameObject: {fileID: 963194225} 292 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 293 | m_LocalPosition: {x: 0, y: 1, z: -10} 294 | m_LocalScale: {x: 1, y: 1, z: 1} 295 | m_Children: [] 296 | m_Father: {fileID: 0} 297 | m_RootOrder: 0 298 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 299 | --- !u!114 &963194229 300 | MonoBehaviour: 301 | m_ObjectHideFlags: 0 302 | m_CorrespondingSourceObject: {fileID: 0} 303 | m_PrefabInstance: {fileID: 0} 304 | m_PrefabAsset: {fileID: 0} 305 | m_GameObject: {fileID: 963194225} 306 | m_Enabled: 1 307 | m_EditorHideFlags: 0 308 | m_Script: {fileID: 11500000, guid: 0f451fab1e6d94aea8fb73803e281bb3, type: 3} 309 | m_Name: 310 | m_EditorClassIdentifier: 311 | --- !u!54 &963194230 312 | Rigidbody: 313 | m_ObjectHideFlags: 0 314 | m_CorrespondingSourceObject: {fileID: 0} 315 | m_PrefabInstance: {fileID: 0} 316 | m_PrefabAsset: {fileID: 0} 317 | m_GameObject: {fileID: 963194225} 318 | serializedVersion: 2 319 | m_Mass: 1 320 | m_Drag: 0 321 | m_AngularDrag: 0.05 322 | m_UseGravity: 1 323 | m_IsKinematic: 0 324 | m_Interpolate: 0 325 | m_Constraints: 0 326 | m_CollisionDetection: 0 327 | -------------------------------------------------------------------------------- /NativeWebSocket/Assets/Samples~/WebSocketExample/WebSocketExampleScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9fc0d4010bbf28b4594072e72b8655ab 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /NativeWebSocket/Assets/WebSocket.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b0aac75ea12c4d6d8aaf04e069a69a7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /NativeWebSocket/Assets/WebSocket/WebSocket.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Net.WebSockets; 5 | using System.Runtime.CompilerServices; 6 | using System.Text; 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | 10 | using AOT; 11 | using System.Runtime.InteropServices; 12 | using UnityEngine; 13 | using System.Collections; 14 | 15 | public class MainThreadUtil : MonoBehaviour 16 | { 17 | public static MainThreadUtil Instance { get; private set; } 18 | public static SynchronizationContext synchronizationContext { get; private set; } 19 | 20 | [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)] 21 | public static void Setup() 22 | { 23 | Instance = new GameObject("MainThreadUtil") 24 | .AddComponent(); 25 | synchronizationContext = SynchronizationContext.Current; 26 | } 27 | 28 | public static void Run(IEnumerator waitForUpdate) 29 | { 30 | synchronizationContext.Post(_ => Instance.StartCoroutine( 31 | waitForUpdate), null); 32 | } 33 | 34 | void Awake() 35 | { 36 | gameObject.hideFlags = HideFlags.HideAndDontSave; 37 | DontDestroyOnLoad(gameObject); 38 | } 39 | } 40 | 41 | public class WaitForUpdate : CustomYieldInstruction 42 | { 43 | public override bool keepWaiting 44 | { 45 | get { return false; } 46 | } 47 | 48 | public MainThreadAwaiter GetAwaiter() 49 | { 50 | var awaiter = new MainThreadAwaiter(); 51 | MainThreadUtil.Run(CoroutineWrapper(this, awaiter)); 52 | return awaiter; 53 | } 54 | 55 | public class MainThreadAwaiter : INotifyCompletion 56 | { 57 | Action continuation; 58 | 59 | public bool IsCompleted { get; set; } 60 | 61 | public void GetResult() { } 62 | 63 | public void Complete() 64 | { 65 | IsCompleted = true; 66 | continuation?.Invoke(); 67 | } 68 | 69 | void INotifyCompletion.OnCompleted(Action continuation) 70 | { 71 | this.continuation = continuation; 72 | } 73 | } 74 | 75 | public static IEnumerator CoroutineWrapper(IEnumerator theWorker, MainThreadAwaiter awaiter) 76 | { 77 | yield return theWorker; 78 | awaiter.Complete(); 79 | } 80 | } 81 | 82 | namespace NativeWebSocket 83 | { 84 | public delegate void WebSocketOpenEventHandler(); 85 | public delegate void WebSocketMessageEventHandler(byte[] data); 86 | public delegate void WebSocketErrorEventHandler(string errorMsg); 87 | public delegate void WebSocketCloseEventHandler(WebSocketCloseCode closeCode); 88 | 89 | public enum WebSocketCloseCode 90 | { 91 | /* Do NOT use NotSet - it's only purpose is to indicate that the close code cannot be parsed. */ 92 | NotSet = 0, 93 | Normal = 1000, 94 | Away = 1001, 95 | ProtocolError = 1002, 96 | UnsupportedData = 1003, 97 | Undefined = 1004, 98 | NoStatus = 1005, 99 | Abnormal = 1006, 100 | InvalidData = 1007, 101 | PolicyViolation = 1008, 102 | TooBig = 1009, 103 | MandatoryExtension = 1010, 104 | ServerError = 1011, 105 | TlsHandshakeFailure = 1015 106 | } 107 | 108 | public enum WebSocketState 109 | { 110 | Connecting, 111 | Open, 112 | Closing, 113 | Closed 114 | } 115 | 116 | public interface IWebSocket 117 | { 118 | event WebSocketOpenEventHandler OnOpen; 119 | event WebSocketMessageEventHandler OnMessage; 120 | event WebSocketErrorEventHandler OnError; 121 | event WebSocketCloseEventHandler OnClose; 122 | 123 | WebSocketState State { get; } 124 | } 125 | 126 | public static class WebSocketHelpers 127 | { 128 | public static WebSocketCloseCode ParseCloseCodeEnum(int closeCode) 129 | { 130 | 131 | if (WebSocketCloseCode.IsDefined(typeof(WebSocketCloseCode), closeCode)) 132 | { 133 | return (WebSocketCloseCode)closeCode; 134 | } 135 | else 136 | { 137 | return WebSocketCloseCode.Undefined; 138 | } 139 | 140 | } 141 | 142 | public static WebSocketException GetErrorMessageFromCode(int errorCode, Exception inner) 143 | { 144 | switch (errorCode) 145 | { 146 | case -1: 147 | return new WebSocketUnexpectedException("WebSocket instance not found.", inner); 148 | case -2: 149 | return new WebSocketInvalidStateException("WebSocket is already connected or in connecting state.", inner); 150 | case -3: 151 | return new WebSocketInvalidStateException("WebSocket is not connected.", inner); 152 | case -4: 153 | return new WebSocketInvalidStateException("WebSocket is already closing.", inner); 154 | case -5: 155 | return new WebSocketInvalidStateException("WebSocket is already closed.", inner); 156 | case -6: 157 | return new WebSocketInvalidStateException("WebSocket is not in open state.", inner); 158 | case -7: 159 | return new WebSocketInvalidArgumentException("Cannot close WebSocket. An invalid code was specified or reason is too long.", inner); 160 | default: 161 | return new WebSocketUnexpectedException("Unknown error.", inner); 162 | } 163 | } 164 | } 165 | 166 | public class WebSocketException : Exception 167 | { 168 | public WebSocketException() { } 169 | public WebSocketException(string message) : base(message) { } 170 | public WebSocketException(string message, Exception inner) : base(message, inner) { } 171 | } 172 | 173 | public class WebSocketUnexpectedException : WebSocketException 174 | { 175 | public WebSocketUnexpectedException() { } 176 | public WebSocketUnexpectedException(string message) : base(message) { } 177 | public WebSocketUnexpectedException(string message, Exception inner) : base(message, inner) { } 178 | } 179 | 180 | public class WebSocketInvalidArgumentException : WebSocketException 181 | { 182 | public WebSocketInvalidArgumentException() { } 183 | public WebSocketInvalidArgumentException(string message) : base(message) { } 184 | public WebSocketInvalidArgumentException(string message, Exception inner) : base(message, inner) { } 185 | } 186 | 187 | public class WebSocketInvalidStateException : WebSocketException 188 | { 189 | public WebSocketInvalidStateException() { } 190 | public WebSocketInvalidStateException(string message) : base(message) { } 191 | public WebSocketInvalidStateException(string message, Exception inner) : base(message, inner) { } 192 | } 193 | 194 | public class WaitForBackgroundThread 195 | { 196 | public ConfiguredTaskAwaitable.ConfiguredTaskAwaiter GetAwaiter() 197 | { 198 | return Task.Run(() => { }).ConfigureAwait(false).GetAwaiter(); 199 | } 200 | } 201 | 202 | #if UNITY_WEBGL && !UNITY_EDITOR 203 | 204 | /// 205 | /// WebSocket class bound to JSLIB. 206 | /// 207 | public class WebSocket : IWebSocket { 208 | 209 | /* WebSocket JSLIB functions */ 210 | [DllImport ("__Internal")] 211 | public static extern int WebSocketConnect (int instanceId); 212 | 213 | [DllImport ("__Internal")] 214 | public static extern int WebSocketClose (int instanceId, int code, string reason); 215 | 216 | [DllImport ("__Internal")] 217 | public static extern int WebSocketSend (int instanceId, byte[] dataPtr, int dataLength); 218 | 219 | [DllImport ("__Internal")] 220 | public static extern int WebSocketSendText (int instanceId, string message); 221 | 222 | [DllImport ("__Internal")] 223 | public static extern int WebSocketGetState (int instanceId); 224 | 225 | protected int instanceId; 226 | 227 | public event WebSocketOpenEventHandler OnOpen; 228 | public event WebSocketMessageEventHandler OnMessage; 229 | public event WebSocketErrorEventHandler OnError; 230 | public event WebSocketCloseEventHandler OnClose; 231 | 232 | public WebSocket (string url, Dictionary headers = null) { 233 | if (!WebSocketFactory.isInitialized) { 234 | WebSocketFactory.Initialize (); 235 | } 236 | 237 | int instanceId = WebSocketFactory.WebSocketAllocate (url); 238 | WebSocketFactory.instances.Add (instanceId, this); 239 | 240 | this.instanceId = instanceId; 241 | } 242 | 243 | public WebSocket (string url, string subprotocol, Dictionary headers = null) { 244 | if (!WebSocketFactory.isInitialized) { 245 | WebSocketFactory.Initialize (); 246 | } 247 | 248 | int instanceId = WebSocketFactory.WebSocketAllocate (url); 249 | WebSocketFactory.instances.Add (instanceId, this); 250 | 251 | WebSocketFactory.WebSocketAddSubProtocol(instanceId, subprotocol); 252 | 253 | this.instanceId = instanceId; 254 | } 255 | 256 | public WebSocket (string url, List subprotocols, Dictionary headers = null) { 257 | if (!WebSocketFactory.isInitialized) { 258 | WebSocketFactory.Initialize (); 259 | } 260 | 261 | int instanceId = WebSocketFactory.WebSocketAllocate (url); 262 | WebSocketFactory.instances.Add (instanceId, this); 263 | 264 | foreach (string subprotocol in subprotocols) { 265 | WebSocketFactory.WebSocketAddSubProtocol(instanceId, subprotocol); 266 | } 267 | 268 | this.instanceId = instanceId; 269 | } 270 | 271 | ~WebSocket () { 272 | WebSocketFactory.HandleInstanceDestroy (this.instanceId); 273 | } 274 | 275 | public int GetInstanceId () { 276 | return this.instanceId; 277 | } 278 | 279 | public Task Connect () { 280 | int ret = WebSocketConnect (this.instanceId); 281 | 282 | if (ret < 0) 283 | throw WebSocketHelpers.GetErrorMessageFromCode (ret, null); 284 | 285 | return Task.CompletedTask; 286 | } 287 | 288 | public void CancelConnection () { 289 | if (State == WebSocketState.Open) 290 | Close (WebSocketCloseCode.Abnormal); 291 | } 292 | 293 | public Task Close (WebSocketCloseCode code = WebSocketCloseCode.Normal, string reason = null) { 294 | int ret = WebSocketClose (this.instanceId, (int) code, reason); 295 | 296 | if (ret < 0) 297 | throw WebSocketHelpers.GetErrorMessageFromCode (ret, null); 298 | 299 | return Task.CompletedTask; 300 | } 301 | 302 | public Task Send (byte[] data) { 303 | int ret = WebSocketSend (this.instanceId, data, data.Length); 304 | 305 | if (ret < 0) 306 | throw WebSocketHelpers.GetErrorMessageFromCode (ret, null); 307 | 308 | return Task.CompletedTask; 309 | } 310 | 311 | public Task SendText (string message) { 312 | int ret = WebSocketSendText (this.instanceId, message); 313 | 314 | if (ret < 0) 315 | throw WebSocketHelpers.GetErrorMessageFromCode (ret, null); 316 | 317 | return Task.CompletedTask; 318 | } 319 | 320 | public WebSocketState State { 321 | get { 322 | int state = WebSocketGetState (this.instanceId); 323 | 324 | if (state < 0) 325 | throw WebSocketHelpers.GetErrorMessageFromCode (state, null); 326 | 327 | switch (state) { 328 | case 0: 329 | return WebSocketState.Connecting; 330 | 331 | case 1: 332 | return WebSocketState.Open; 333 | 334 | case 2: 335 | return WebSocketState.Closing; 336 | 337 | case 3: 338 | return WebSocketState.Closed; 339 | 340 | default: 341 | return WebSocketState.Closed; 342 | } 343 | } 344 | } 345 | 346 | public void DelegateOnOpenEvent () { 347 | this.OnOpen?.Invoke (); 348 | } 349 | 350 | public void DelegateOnMessageEvent (byte[] data) { 351 | this.OnMessage?.Invoke (data); 352 | } 353 | 354 | public void DelegateOnErrorEvent (string errorMsg) { 355 | this.OnError?.Invoke (errorMsg); 356 | } 357 | 358 | public void DelegateOnCloseEvent (int closeCode) { 359 | this.OnClose?.Invoke (WebSocketHelpers.ParseCloseCodeEnum (closeCode)); 360 | } 361 | 362 | } 363 | 364 | #else 365 | 366 | public class WebSocket : IWebSocket 367 | { 368 | public event WebSocketOpenEventHandler OnOpen; 369 | public event WebSocketMessageEventHandler OnMessage; 370 | public event WebSocketErrorEventHandler OnError; 371 | public event WebSocketCloseEventHandler OnClose; 372 | 373 | private Uri uri; 374 | private Dictionary headers; 375 | private List subprotocols; 376 | private ClientWebSocket m_Socket = new ClientWebSocket(); 377 | 378 | private CancellationTokenSource m_TokenSource; 379 | private CancellationToken m_CancellationToken; 380 | 381 | private readonly object OutgoingMessageLock = new object(); 382 | private readonly object IncomingMessageLock = new object(); 383 | 384 | private bool isSending = false; 385 | private List> sendBytesQueue = new List>(); 386 | private List> sendTextQueue = new List>(); 387 | 388 | public WebSocket(string url, Dictionary headers = null) 389 | { 390 | uri = new Uri(url); 391 | 392 | if (headers == null) 393 | { 394 | this.headers = new Dictionary(); 395 | } 396 | else 397 | { 398 | this.headers = headers; 399 | } 400 | 401 | subprotocols = new List(); 402 | 403 | string protocol = uri.Scheme; 404 | if (!protocol.Equals("ws") && !protocol.Equals("wss")) 405 | throw new ArgumentException("Unsupported protocol: " + protocol); 406 | } 407 | 408 | public WebSocket(string url, string subprotocol, Dictionary headers = null) 409 | { 410 | uri = new Uri(url); 411 | 412 | if (headers == null) 413 | { 414 | this.headers = new Dictionary(); 415 | } 416 | else 417 | { 418 | this.headers = headers; 419 | } 420 | 421 | subprotocols = new List {subprotocol}; 422 | 423 | string protocol = uri.Scheme; 424 | if (!protocol.Equals("ws") && !protocol.Equals("wss")) 425 | throw new ArgumentException("Unsupported protocol: " + protocol); 426 | } 427 | 428 | public WebSocket(string url, List subprotocols, Dictionary headers = null) 429 | { 430 | uri = new Uri(url); 431 | 432 | if (headers == null) 433 | { 434 | this.headers = new Dictionary(); 435 | } 436 | else 437 | { 438 | this.headers = headers; 439 | } 440 | 441 | this.subprotocols = subprotocols; 442 | 443 | string protocol = uri.Scheme; 444 | if (!protocol.Equals("ws") && !protocol.Equals("wss")) 445 | throw new ArgumentException("Unsupported protocol: " + protocol); 446 | } 447 | 448 | public void CancelConnection() 449 | { 450 | m_TokenSource?.Cancel(); 451 | } 452 | 453 | public async Task Connect() 454 | { 455 | try 456 | { 457 | m_TokenSource = new CancellationTokenSource(); 458 | m_CancellationToken = m_TokenSource.Token; 459 | 460 | m_Socket = new ClientWebSocket(); 461 | 462 | foreach (var header in headers) 463 | { 464 | m_Socket.Options.SetRequestHeader(header.Key, header.Value); 465 | } 466 | 467 | foreach (string subprotocol in subprotocols) { 468 | m_Socket.Options.AddSubProtocol(subprotocol); 469 | } 470 | 471 | await m_Socket.ConnectAsync(uri, m_CancellationToken); 472 | OnOpen?.Invoke(); 473 | 474 | await Receive(); 475 | } 476 | catch (Exception ex) 477 | { 478 | OnError?.Invoke(ex.Message); 479 | OnClose?.Invoke(WebSocketCloseCode.Abnormal); 480 | } 481 | finally 482 | { 483 | if (m_Socket != null) 484 | { 485 | m_TokenSource.Cancel(); 486 | m_Socket.Dispose(); 487 | } 488 | } 489 | } 490 | 491 | public WebSocketState State 492 | { 493 | get 494 | { 495 | switch (m_Socket.State) 496 | { 497 | case System.Net.WebSockets.WebSocketState.Connecting: 498 | return WebSocketState.Connecting; 499 | 500 | case System.Net.WebSockets.WebSocketState.Open: 501 | return WebSocketState.Open; 502 | 503 | case System.Net.WebSockets.WebSocketState.CloseSent: 504 | case System.Net.WebSockets.WebSocketState.CloseReceived: 505 | return WebSocketState.Closing; 506 | 507 | case System.Net.WebSockets.WebSocketState.Closed: 508 | return WebSocketState.Closed; 509 | 510 | default: 511 | return WebSocketState.Closed; 512 | } 513 | } 514 | } 515 | 516 | public Task Send(byte[] bytes) 517 | { 518 | // return m_Socket.SendAsync(buffer, WebSocketMessageType.Binary, true, CancellationToken.None); 519 | return SendMessage(sendBytesQueue, WebSocketMessageType.Binary, new ArraySegment(bytes)); 520 | } 521 | 522 | public Task SendText(string message) 523 | { 524 | var encoded = Encoding.UTF8.GetBytes(message); 525 | 526 | // m_Socket.SendAsync(buffer, WebSocketMessageType.Text, true, CancellationToken.None); 527 | return SendMessage(sendTextQueue, WebSocketMessageType.Text, new ArraySegment(encoded, 0, encoded.Length)); 528 | } 529 | 530 | private async Task SendMessage(List> queue, WebSocketMessageType messageType, ArraySegment buffer) 531 | { 532 | // Return control to the calling method immediately. 533 | // await Task.Yield (); 534 | 535 | // Make sure we have data. 536 | if (buffer.Count == 0) 537 | { 538 | return; 539 | } 540 | 541 | // The state of the connection is contained in the context Items dictionary. 542 | bool sending; 543 | 544 | lock (OutgoingMessageLock) 545 | { 546 | sending = isSending; 547 | 548 | // If not, we are now. 549 | if (!isSending) 550 | { 551 | isSending = true; 552 | } 553 | } 554 | 555 | if (!sending) 556 | { 557 | // Lock with a timeout, just in case. 558 | if (!Monitor.TryEnter(m_Socket, 1000)) 559 | { 560 | // If we couldn't obtain exclusive access to the socket in one second, something is wrong. 561 | await m_Socket.CloseAsync(WebSocketCloseStatus.InternalServerError, string.Empty, m_CancellationToken); 562 | return; 563 | } 564 | 565 | try 566 | { 567 | // Send the message synchronously. 568 | var t = m_Socket.SendAsync(buffer, messageType, true, m_CancellationToken); 569 | t.Wait(m_CancellationToken); 570 | } 571 | finally 572 | { 573 | Monitor.Exit(m_Socket); 574 | 575 | // Note that we've finished sending. 576 | lock (OutgoingMessageLock) 577 | { 578 | isSending = false; 579 | } 580 | } 581 | 582 | // Handle any queued messages. 583 | await HandleQueue(queue, messageType); 584 | } 585 | else 586 | { 587 | // Add the message to the queue. 588 | lock (OutgoingMessageLock) 589 | { 590 | queue.Add(buffer); 591 | } 592 | } 593 | } 594 | 595 | private async Task HandleQueue(List> queue, WebSocketMessageType messageType) 596 | { 597 | var buffer = new ArraySegment(); 598 | lock (OutgoingMessageLock) 599 | { 600 | // Check for an item in the queue. 601 | if (queue.Count > 0) 602 | { 603 | // Pull it off the top. 604 | buffer = queue[0]; 605 | queue.RemoveAt(0); 606 | } 607 | } 608 | 609 | // Send that message. 610 | if (buffer.Count > 0) 611 | { 612 | await SendMessage(queue, messageType, buffer); 613 | } 614 | } 615 | 616 | private List m_MessageList = new List(); 617 | 618 | // simple dispatcher for queued messages. 619 | public void DispatchMessageQueue() 620 | { 621 | if (m_MessageList.Count == 0) 622 | { 623 | return; 624 | } 625 | 626 | List messageListCopy; 627 | 628 | lock (IncomingMessageLock) 629 | { 630 | messageListCopy = new List(m_MessageList); 631 | m_MessageList.Clear(); 632 | } 633 | 634 | var len = messageListCopy.Count; 635 | for (int i = 0; i < len; i++) 636 | { 637 | OnMessage?.Invoke(messageListCopy[i]); 638 | } 639 | } 640 | 641 | public async Task Receive() 642 | { 643 | WebSocketCloseCode closeCode = WebSocketCloseCode.Abnormal; 644 | await new WaitForBackgroundThread(); 645 | 646 | ArraySegment buffer = new ArraySegment(new byte[8192]); 647 | try 648 | { 649 | while (m_Socket.State == System.Net.WebSockets.WebSocketState.Open) 650 | { 651 | WebSocketReceiveResult result = null; 652 | 653 | using (var ms = new MemoryStream()) 654 | { 655 | do 656 | { 657 | result = await m_Socket.ReceiveAsync(buffer, m_CancellationToken); 658 | ms.Write(buffer.Array, buffer.Offset, result.Count); 659 | } 660 | while (!result.EndOfMessage); 661 | 662 | ms.Seek(0, SeekOrigin.Begin); 663 | 664 | if (result.MessageType == WebSocketMessageType.Text) 665 | { 666 | lock (IncomingMessageLock) 667 | { 668 | m_MessageList.Add(ms.ToArray()); 669 | } 670 | 671 | //using (var reader = new StreamReader(ms, Encoding.UTF8)) 672 | //{ 673 | // string message = reader.ReadToEnd(); 674 | // OnMessage?.Invoke(this, new MessageEventArgs(message)); 675 | //} 676 | } 677 | else if (result.MessageType == WebSocketMessageType.Binary) 678 | { 679 | lock (IncomingMessageLock) 680 | { 681 | m_MessageList.Add(ms.ToArray()); 682 | } 683 | } 684 | else if (result.MessageType == WebSocketMessageType.Close) 685 | { 686 | await Close(); 687 | closeCode = WebSocketHelpers.ParseCloseCodeEnum((int)result.CloseStatus); 688 | break; 689 | } 690 | } 691 | } 692 | } 693 | catch (Exception) 694 | { 695 | m_TokenSource.Cancel(); 696 | } 697 | finally 698 | { 699 | await new WaitForUpdate(); 700 | OnClose?.Invoke(closeCode); 701 | } 702 | } 703 | 704 | public async Task Close() 705 | { 706 | if (State == WebSocketState.Open) 707 | { 708 | await m_Socket.CloseAsync(WebSocketCloseStatus.NormalClosure, string.Empty, m_CancellationToken); 709 | } 710 | } 711 | } 712 | #endif 713 | 714 | /// 715 | /// Factory 716 | /// 717 | 718 | /// 719 | /// Class providing static access methods to work with JSLIB WebSocket or WebSocketSharp interface 720 | /// 721 | public static class WebSocketFactory 722 | { 723 | 724 | #if UNITY_WEBGL && !UNITY_EDITOR 725 | /* Map of websocket instances */ 726 | public static Dictionary instances = new Dictionary (); 727 | 728 | /* Delegates */ 729 | public delegate void OnOpenCallback (int instanceId); 730 | public delegate void OnMessageCallback (int instanceId, System.IntPtr msgPtr, int msgSize); 731 | public delegate void OnErrorCallback (int instanceId, System.IntPtr errorPtr); 732 | public delegate void OnCloseCallback (int instanceId, int closeCode); 733 | 734 | /* WebSocket JSLIB callback setters and other functions */ 735 | [DllImport ("__Internal")] 736 | public static extern int WebSocketAllocate (string url); 737 | 738 | [DllImport ("__Internal")] 739 | public static extern int WebSocketAddSubProtocol (int instanceId, string subprotocol); 740 | 741 | [DllImport ("__Internal")] 742 | public static extern void WebSocketFree (int instanceId); 743 | 744 | [DllImport ("__Internal")] 745 | public static extern void WebSocketSetOnOpen (OnOpenCallback callback); 746 | 747 | [DllImport ("__Internal")] 748 | public static extern void WebSocketSetOnMessage (OnMessageCallback callback); 749 | 750 | [DllImport ("__Internal")] 751 | public static extern void WebSocketSetOnError (OnErrorCallback callback); 752 | 753 | [DllImport ("__Internal")] 754 | public static extern void WebSocketSetOnClose (OnCloseCallback callback); 755 | 756 | /* If callbacks was initialized and set */ 757 | public static bool isInitialized = false; 758 | 759 | /* 760 | * Initialize WebSocket callbacks to JSLIB 761 | */ 762 | public static void Initialize () { 763 | 764 | WebSocketSetOnOpen (DelegateOnOpenEvent); 765 | WebSocketSetOnMessage (DelegateOnMessageEvent); 766 | WebSocketSetOnError (DelegateOnErrorEvent); 767 | WebSocketSetOnClose (DelegateOnCloseEvent); 768 | 769 | isInitialized = true; 770 | 771 | } 772 | 773 | /// 774 | /// Called when instance is destroyed (by destructor) 775 | /// Method removes instance from map and free it in JSLIB implementation 776 | /// 777 | /// Instance identifier. 778 | public static void HandleInstanceDestroy (int instanceId) { 779 | 780 | instances.Remove (instanceId); 781 | WebSocketFree (instanceId); 782 | 783 | } 784 | 785 | [MonoPInvokeCallback (typeof (OnOpenCallback))] 786 | public static void DelegateOnOpenEvent (int instanceId) { 787 | 788 | WebSocket instanceRef; 789 | 790 | if (instances.TryGetValue (instanceId, out instanceRef)) { 791 | instanceRef.DelegateOnOpenEvent (); 792 | } 793 | 794 | } 795 | 796 | [MonoPInvokeCallback (typeof (OnMessageCallback))] 797 | public static void DelegateOnMessageEvent (int instanceId, System.IntPtr msgPtr, int msgSize) { 798 | 799 | WebSocket instanceRef; 800 | 801 | if (instances.TryGetValue (instanceId, out instanceRef)) { 802 | byte[] msg = new byte[msgSize]; 803 | Marshal.Copy (msgPtr, msg, 0, msgSize); 804 | 805 | instanceRef.DelegateOnMessageEvent (msg); 806 | } 807 | 808 | } 809 | 810 | [MonoPInvokeCallback (typeof (OnErrorCallback))] 811 | public static void DelegateOnErrorEvent (int instanceId, System.IntPtr errorPtr) { 812 | 813 | WebSocket instanceRef; 814 | 815 | if (instances.TryGetValue (instanceId, out instanceRef)) { 816 | 817 | string errorMsg = Marshal.PtrToStringAuto (errorPtr); 818 | instanceRef.DelegateOnErrorEvent (errorMsg); 819 | 820 | } 821 | 822 | } 823 | 824 | [MonoPInvokeCallback (typeof (OnCloseCallback))] 825 | public static void DelegateOnCloseEvent (int instanceId, int closeCode) { 826 | 827 | WebSocket instanceRef; 828 | 829 | if (instances.TryGetValue (instanceId, out instanceRef)) { 830 | instanceRef.DelegateOnCloseEvent (closeCode); 831 | } 832 | 833 | } 834 | #endif 835 | 836 | /// 837 | /// Create WebSocket client instance 838 | /// 839 | /// The WebSocket instance. 840 | /// WebSocket valid URL. 841 | public static WebSocket CreateInstance(string url) 842 | { 843 | return new WebSocket(url); 844 | } 845 | 846 | } 847 | 848 | } 849 | -------------------------------------------------------------------------------- /NativeWebSocket/Assets/WebSocket/WebSocket.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: df0e653fbf9005342904aa0f14d46088 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /NativeWebSocket/Assets/WebSocket/WebSocket.jslib: -------------------------------------------------------------------------------- 1 | 2 | var LibraryWebSocket = { 3 | $webSocketState: { 4 | /* 5 | * Map of instances 6 | * 7 | * Instance structure: 8 | * { 9 | * url: string, 10 | * ws: WebSocket 11 | * } 12 | */ 13 | instances: {}, 14 | 15 | /* Last instance ID */ 16 | lastId: 0, 17 | 18 | /* Event listeners */ 19 | onOpen: null, 20 | onMessage: null, 21 | onError: null, 22 | onClose: null, 23 | 24 | /* Debug mode */ 25 | debug: false 26 | }, 27 | 28 | /** 29 | * Set onOpen callback 30 | * 31 | * @param callback Reference to C# static function 32 | */ 33 | WebSocketSetOnOpen: function(callback) { 34 | 35 | webSocketState.onOpen = callback; 36 | 37 | }, 38 | 39 | /** 40 | * Set onMessage callback 41 | * 42 | * @param callback Reference to C# static function 43 | */ 44 | WebSocketSetOnMessage: function(callback) { 45 | 46 | webSocketState.onMessage = callback; 47 | 48 | }, 49 | 50 | /** 51 | * Set onError callback 52 | * 53 | * @param callback Reference to C# static function 54 | */ 55 | WebSocketSetOnError: function(callback) { 56 | 57 | webSocketState.onError = callback; 58 | 59 | }, 60 | 61 | /** 62 | * Set onClose callback 63 | * 64 | * @param callback Reference to C# static function 65 | */ 66 | WebSocketSetOnClose: function(callback) { 67 | 68 | webSocketState.onClose = callback; 69 | 70 | }, 71 | 72 | /** 73 | * Allocate new WebSocket instance struct 74 | * 75 | * @param url Server URL 76 | */ 77 | WebSocketAllocate: function(url) { 78 | 79 | var urlStr = UTF8ToString(url); 80 | var id = webSocketState.lastId++; 81 | 82 | webSocketState.instances[id] = { 83 | subprotocols: [], 84 | url: urlStr, 85 | ws: null 86 | }; 87 | 88 | return id; 89 | 90 | }, 91 | 92 | /** 93 | * Add subprotocol to instance 94 | * 95 | * @param instanceId Instance ID 96 | * @param subprotocol Subprotocol name to add to instance 97 | */ 98 | WebSocketAddSubProtocol: function(instanceId, subprotocol) { 99 | 100 | var subprotocolStr = UTF8ToString(subprotocol); 101 | webSocketState.instances[instanceId].subprotocols.push(subprotocolStr); 102 | 103 | }, 104 | 105 | /** 106 | * Remove reference to WebSocket instance 107 | * 108 | * If socket is not closed function will close it but onClose event will not be emitted because 109 | * this function should be invoked by C# WebSocket destructor. 110 | * 111 | * @param instanceId Instance ID 112 | */ 113 | WebSocketFree: function(instanceId) { 114 | 115 | var instance = webSocketState.instances[instanceId]; 116 | 117 | if (!instance) return 0; 118 | 119 | // Close if not closed 120 | if (instance.ws && instance.ws.readyState < 2) 121 | instance.ws.close(); 122 | 123 | // Remove reference 124 | delete webSocketState.instances[instanceId]; 125 | 126 | return 0; 127 | 128 | }, 129 | 130 | /** 131 | * Connect WebSocket to the server 132 | * 133 | * @param instanceId Instance ID 134 | */ 135 | WebSocketConnect: function(instanceId) { 136 | 137 | var instance = webSocketState.instances[instanceId]; 138 | if (!instance) return -1; 139 | 140 | if (instance.ws !== null) 141 | return -2; 142 | 143 | instance.ws = new WebSocket(instance.url, instance.subprotocols); 144 | 145 | instance.ws.binaryType = 'arraybuffer'; 146 | 147 | instance.ws.onopen = function() { 148 | 149 | if (webSocketState.debug) 150 | console.log("[JSLIB WebSocket] Connected."); 151 | 152 | if (webSocketState.onOpen) 153 | Module.dynCall_vi(webSocketState.onOpen, instanceId); 154 | 155 | }; 156 | 157 | instance.ws.onmessage = function(ev) { 158 | 159 | if (webSocketState.debug) 160 | console.log("[JSLIB WebSocket] Received message:", ev.data); 161 | 162 | if (webSocketState.onMessage === null) 163 | return; 164 | 165 | if (ev.data instanceof ArrayBuffer) { 166 | 167 | var dataBuffer = new Uint8Array(ev.data); 168 | 169 | var buffer = _malloc(dataBuffer.length); 170 | HEAPU8.set(dataBuffer, buffer); 171 | 172 | try { 173 | Module.dynCall_viii(webSocketState.onMessage, instanceId, buffer, dataBuffer.length); 174 | } finally { 175 | _free(buffer); 176 | } 177 | 178 | } else { 179 | var dataBuffer = (new TextEncoder()).encode(ev.data); 180 | 181 | var buffer = _malloc(dataBuffer.length); 182 | HEAPU8.set(dataBuffer, buffer); 183 | 184 | try { 185 | Module.dynCall_viii(webSocketState.onMessage, instanceId, buffer, dataBuffer.length); 186 | } finally { 187 | _free(buffer); 188 | } 189 | 190 | } 191 | 192 | }; 193 | 194 | instance.ws.onerror = function(ev) { 195 | 196 | if (webSocketState.debug) 197 | console.log("[JSLIB WebSocket] Error occured."); 198 | 199 | if (webSocketState.onError) { 200 | 201 | var msg = "WebSocket error."; 202 | var length = lengthBytesUTF8(msg) + 1; 203 | var buffer = _malloc(length); 204 | stringToUTF8(msg, buffer, length); 205 | 206 | try { 207 | Module.dynCall_vii(webSocketState.onError, instanceId, buffer); 208 | } finally { 209 | _free(buffer); 210 | } 211 | 212 | } 213 | 214 | }; 215 | 216 | instance.ws.onclose = function(ev) { 217 | 218 | if (webSocketState.debug) 219 | console.log("[JSLIB WebSocket] Closed."); 220 | 221 | if (webSocketState.onClose) 222 | Module.dynCall_vii(webSocketState.onClose, instanceId, ev.code); 223 | 224 | delete instance.ws; 225 | 226 | }; 227 | 228 | return 0; 229 | 230 | }, 231 | 232 | /** 233 | * Close WebSocket connection 234 | * 235 | * @param instanceId Instance ID 236 | * @param code Close status code 237 | * @param reasonPtr Pointer to reason string 238 | */ 239 | WebSocketClose: function(instanceId, code, reasonPtr) { 240 | 241 | var instance = webSocketState.instances[instanceId]; 242 | if (!instance) return -1; 243 | 244 | if (!instance.ws) 245 | return -3; 246 | 247 | if (instance.ws.readyState === 2) 248 | return -4; 249 | 250 | if (instance.ws.readyState === 3) 251 | return -5; 252 | 253 | var reason = ( reasonPtr ? UTF8ToString(reasonPtr) : undefined ); 254 | 255 | try { 256 | instance.ws.close(code, reason); 257 | } catch(err) { 258 | return -7; 259 | } 260 | 261 | return 0; 262 | 263 | }, 264 | 265 | /** 266 | * Send message over WebSocket 267 | * 268 | * @param instanceId Instance ID 269 | * @param bufferPtr Pointer to the message buffer 270 | * @param length Length of the message in the buffer 271 | */ 272 | WebSocketSend: function(instanceId, bufferPtr, length) { 273 | 274 | var instance = webSocketState.instances[instanceId]; 275 | if (!instance) return -1; 276 | 277 | if (!instance.ws) 278 | return -3; 279 | 280 | if (instance.ws.readyState !== 1) 281 | return -6; 282 | 283 | instance.ws.send(HEAPU8.buffer.slice(bufferPtr, bufferPtr + length)); 284 | 285 | return 0; 286 | 287 | }, 288 | 289 | /** 290 | * Send text message over WebSocket 291 | * 292 | * @param instanceId Instance ID 293 | * @param bufferPtr Pointer to the message buffer 294 | * @param length Length of the message in the buffer 295 | */ 296 | WebSocketSendText: function(instanceId, message) { 297 | 298 | var instance = webSocketState.instances[instanceId]; 299 | if (!instance) return -1; 300 | 301 | if (!instance.ws) 302 | return -3; 303 | 304 | if (instance.ws.readyState !== 1) 305 | return -6; 306 | 307 | instance.ws.send(UTF8ToString(message)); 308 | 309 | return 0; 310 | 311 | }, 312 | 313 | /** 314 | * Return WebSocket readyState 315 | * 316 | * @param instanceId Instance ID 317 | */ 318 | WebSocketGetState: function(instanceId) { 319 | 320 | var instance = webSocketState.instances[instanceId]; 321 | if (!instance) return -1; 322 | 323 | if (instance.ws) 324 | return instance.ws.readyState; 325 | else 326 | return 3; 327 | 328 | } 329 | 330 | }; 331 | 332 | autoAddDeps(LibraryWebSocket, '$webSocketState'); 333 | mergeInto(LibraryManager.library, LibraryWebSocket); 334 | -------------------------------------------------------------------------------- /NativeWebSocket/Assets/WebSocket/WebSocket.jslib.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b767cc116f846f4b813fe00142b8736 3 | PluginImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | iconMap: {} 7 | executionOrder: {} 8 | defineConstraints: [] 9 | isPreloaded: 0 10 | isOverridable: 0 11 | isExplicitlyReferenced: 0 12 | validateReferences: 1 13 | platformData: 14 | - first: 15 | Any: 16 | second: 17 | enabled: 0 18 | settings: {} 19 | - first: 20 | Editor: Editor 21 | second: 22 | enabled: 0 23 | settings: 24 | DefaultValueInitialized: true 25 | - first: 26 | WebGL: WebGL 27 | second: 28 | enabled: 1 29 | settings: {} 30 | userData: 31 | assetBundleName: 32 | assetBundleVariant: 33 | -------------------------------------------------------------------------------- /NativeWebSocket/Assets/WebSocket/endel.nativewebsocket.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "endel.nativewebsocket" 3 | } 4 | -------------------------------------------------------------------------------- /NativeWebSocket/Assets/WebSocket/endel.nativewebsocket.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 04376767bc1f3b428aefa3d20743e819 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /NativeWebSocket/Assets/WebSocketExample.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e7a91621cd77941248ad2d795977b3c7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /NativeWebSocket/Assets/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.endel.nativewebsocket", 3 | "version": "1.1.5", 4 | "description": "WebSocket client for Unity - with no external dependencies (WebGL, Native, Android, iOS, UWP).", 5 | "license": "Apache 2.0", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/endel/NativeWebSocket.git" 9 | }, 10 | "author": { 11 | "name": "Endel Dreyer", 12 | "email": "endel.dreyer@gmail.com", 13 | "url": "https://github.com/endel/NativeWebSocket" 14 | }, 15 | "keywords": [ 16 | "websocket", 17 | "websockets", 18 | "native websocket", 19 | "native websockets" 20 | ], 21 | "displayName": "Native WebSockets", 22 | "unity": "2019.1", 23 | "dependencies": {}, 24 | "samples": [ 25 | { 26 | "displayName": "Example", 27 | "description": "WebSocket Example", 28 | "path": "Samples~/WebSocketExample" 29 | } ] 30 | } 31 | -------------------------------------------------------------------------------- /NativeWebSocket/Assets/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a9f6363663f95e3499b2616618078182 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /NativeWebSocket/Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": "1.15.7", 4 | "com.unity.ext.nunit": "1.0.6", 5 | "com.unity.ide.rider": "3.0.9", 6 | "com.unity.ide.visualstudio": "2.0.14", 7 | "com.unity.ide.vscode": "1.2.4", 8 | "com.unity.test-framework": "1.1.29", 9 | "com.unity.textmeshpro": "3.0.6", 10 | "com.unity.timeline": "1.6.3", 11 | "com.unity.ugui": "1.0.0", 12 | "com.unity.modules.ai": "1.0.0", 13 | "com.unity.modules.androidjni": "1.0.0", 14 | "com.unity.modules.animation": "1.0.0", 15 | "com.unity.modules.assetbundle": "1.0.0", 16 | "com.unity.modules.audio": "1.0.0", 17 | "com.unity.modules.cloth": "1.0.0", 18 | "com.unity.modules.director": "1.0.0", 19 | "com.unity.modules.imageconversion": "1.0.0", 20 | "com.unity.modules.imgui": "1.0.0", 21 | "com.unity.modules.jsonserialize": "1.0.0", 22 | "com.unity.modules.particlesystem": "1.0.0", 23 | "com.unity.modules.physics": "1.0.0", 24 | "com.unity.modules.physics2d": "1.0.0", 25 | "com.unity.modules.screencapture": "1.0.0", 26 | "com.unity.modules.terrain": "1.0.0", 27 | "com.unity.modules.terrainphysics": "1.0.0", 28 | "com.unity.modules.tilemap": "1.0.0", 29 | "com.unity.modules.ui": "1.0.0", 30 | "com.unity.modules.uielements": "1.0.0", 31 | "com.unity.modules.umbra": "1.0.0", 32 | "com.unity.modules.unityanalytics": "1.0.0", 33 | "com.unity.modules.unitywebrequest": "1.0.0", 34 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 35 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 36 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 37 | "com.unity.modules.unitywebrequestwww": "1.0.0", 38 | "com.unity.modules.vehicles": "1.0.0", 39 | "com.unity.modules.video": "1.0.0", 40 | "com.unity.modules.vr": "1.0.0", 41 | "com.unity.modules.wind": "1.0.0", 42 | "com.unity.modules.xr": "1.0.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /NativeWebSocket/ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 1024 20 | -------------------------------------------------------------------------------- /NativeWebSocket/ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /NativeWebSocket/ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 11 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ContactPairsMode: 0 26 | m_BroadphaseType: 0 27 | m_WorldBounds: 28 | m_Center: {x: 0, y: 0, z: 0} 29 | m_Extent: {x: 250, y: 250, z: 250} 30 | m_WorldSubdivisions: 8 31 | m_FrictionType: 0 32 | m_EnableEnhancedDeterminism: 0 33 | m_EnableUnifiedHeightmaps: 1 34 | m_DefaultMaxAngluarSpeed: 7 35 | -------------------------------------------------------------------------------- /NativeWebSocket/ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | m_configObjects: {} 9 | -------------------------------------------------------------------------------- /NativeWebSocket/ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 11 7 | m_SerializationMode: 2 8 | m_LineEndingsForNewScripts: 2 9 | m_DefaultBehaviorMode: 0 10 | m_PrefabRegularEnvironment: {fileID: 0} 11 | m_PrefabUIEnvironment: {fileID: 0} 12 | m_SpritePackerMode: 0 13 | m_SpritePackerPaddingPower: 1 14 | m_EtcTextureCompressorBehavior: 1 15 | m_EtcTextureFastCompressor: 1 16 | m_EtcTextureNormalCompressor: 2 17 | m_EtcTextureBestCompressor: 4 18 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref 19 | m_ProjectGenerationRootNamespace: 20 | m_EnableTextureStreamingInEditMode: 1 21 | m_EnableTextureStreamingInPlayMode: 1 22 | m_AsyncShaderCompilation: 1 23 | m_CachingShaderPreprocessor: 0 24 | m_EnterPlayModeOptionsEnabled: 0 25 | m_EnterPlayModeOptions: 3 26 | m_GameObjectNamingDigits: 1 27 | m_GameObjectNamingScheme: 0 28 | m_AssetNamingUsesSpace: 1 29 | m_UseLegacyProbeSampleCount: 1 30 | m_SerializeInlineMappingsOnOneLine: 0 31 | m_DisableCookiesInLightmapper: 1 32 | m_AssetPipelineMode: 1 33 | m_CacheServerMode: 0 34 | m_CacheServerEndpoint: 35 | m_CacheServerNamespacePrefix: default 36 | m_CacheServerEnableDownload: 1 37 | m_CacheServerEnableUpload: 1 38 | m_CacheServerEnableAuth: 0 39 | m_CacheServerEnableTls: 0 40 | -------------------------------------------------------------------------------- /NativeWebSocket/ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 12 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} 40 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 41 | m_PreloadedShaders: [] 42 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 43 | type: 0} 44 | m_CustomRenderPipeline: {fileID: 0} 45 | m_TransparencySortMode: 0 46 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 47 | m_DefaultRenderingPath: 1 48 | m_DefaultMobileRenderingPath: 1 49 | m_TierSettings: [] 50 | m_LightmapStripping: 0 51 | m_FogStripping: 0 52 | m_InstancingStripping: 0 53 | m_LightmapKeepPlain: 1 54 | m_LightmapKeepDirCombined: 1 55 | m_LightmapKeepDynamicPlain: 1 56 | m_LightmapKeepDynamicDirCombined: 1 57 | m_LightmapKeepShadowMask: 1 58 | m_LightmapKeepSubtractive: 1 59 | m_FogKeepLinear: 1 60 | m_FogKeepExp: 1 61 | m_FogKeepExp2: 1 62 | m_AlbedoSwatchInfos: [] 63 | m_LightsUseLinearIntensity: 0 64 | m_LightsUseColorTemperature: 0 65 | -------------------------------------------------------------------------------- /NativeWebSocket/ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /NativeWebSocket/ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | maxJobWorkers: 0 89 | preserveTilesOutsideBounds: 0 90 | debug: 91 | m_Flags: 0 92 | m_SettingNames: 93 | - Humanoid 94 | -------------------------------------------------------------------------------- /NativeWebSocket/ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_AutoSimulation: 1 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /NativeWebSocket/ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_DefaultPresets: {} 8 | -------------------------------------------------------------------------------- /NativeWebSocket/ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 18 7 | productGUID: dc7225b1f8ee64a3abfd6eb883cd32ec 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | AndroidEnableSustainedPerformanceMode: 0 11 | defaultScreenOrientation: 4 12 | targetDevice: 2 13 | useOnDemandResources: 0 14 | accelerometerFrequency: 60 15 | companyName: gamestdio 16 | productName: UnityWebSockets 17 | defaultCursor: {fileID: 0} 18 | cursorHotspot: {x: 0, y: 0} 19 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 20 | m_ShowUnitySplashScreen: 1 21 | m_ShowUnitySplashLogo: 1 22 | m_SplashScreenOverlayOpacity: 1 23 | m_SplashScreenAnimation: 1 24 | m_SplashScreenLogoStyle: 1 25 | m_SplashScreenDrawMode: 0 26 | m_SplashScreenBackgroundAnimationZoom: 1 27 | m_SplashScreenLogoAnimationZoom: 1 28 | m_SplashScreenBackgroundLandscapeAspect: 1 29 | m_SplashScreenBackgroundPortraitAspect: 1 30 | m_SplashScreenBackgroundLandscapeUvs: 31 | serializedVersion: 2 32 | x: 0 33 | y: 0 34 | width: 1 35 | height: 1 36 | m_SplashScreenBackgroundPortraitUvs: 37 | serializedVersion: 2 38 | x: 0 39 | y: 0 40 | width: 1 41 | height: 1 42 | m_SplashScreenLogos: [] 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 1024 46 | defaultScreenHeight: 768 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 0 51 | m_MTRendering: 1 52 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 53 | iosShowActivityIndicatorOnLoading: -1 54 | androidShowActivityIndicatorOnLoading: -1 55 | displayResolutionDialog: 0 56 | iosUseCustomAppBackgroundBehavior: 0 57 | iosAllowHTTPDownload: 1 58 | allowedAutorotateToPortrait: 1 59 | allowedAutorotateToPortraitUpsideDown: 1 60 | allowedAutorotateToLandscapeRight: 1 61 | allowedAutorotateToLandscapeLeft: 1 62 | useOSAutorotation: 1 63 | use32BitDisplayBuffer: 1 64 | preserveFramebufferAlpha: 0 65 | disableDepthAndStencilBuffers: 0 66 | androidStartInFullscreen: 1 67 | androidRenderOutsideSafeArea: 1 68 | androidUseSwappy: 0 69 | androidBlitType: 0 70 | defaultIsNativeResolution: 1 71 | macRetinaSupport: 1 72 | runInBackground: 1 73 | captureSingleScreen: 0 74 | muteOtherAudioSources: 0 75 | Prepare IOS For Recording: 0 76 | Force IOS Speakers When Recording: 0 77 | deferSystemGesturesMode: 0 78 | hideHomeButton: 0 79 | submitAnalytics: 1 80 | usePlayerLog: 1 81 | bakeCollisionMeshes: 0 82 | forceSingleInstance: 0 83 | useFlipModelSwapchain: 1 84 | resizableWindow: 0 85 | useMacAppStoreValidation: 0 86 | macAppStoreCategory: public.app-category.games 87 | gpuSkinning: 1 88 | graphicsJobs: 0 89 | xboxPIXTextureCapture: 0 90 | xboxEnableAvatar: 0 91 | xboxEnableKinect: 0 92 | xboxEnableKinectAutoTracking: 0 93 | xboxEnableFitness: 0 94 | visibleInBackground: 1 95 | allowFullscreenSwitch: 1 96 | graphicsJobMode: 0 97 | fullscreenMode: 1 98 | xboxSpeechDB: 0 99 | xboxEnableHeadOrientation: 0 100 | xboxEnableGuest: 0 101 | xboxEnablePIXSampling: 0 102 | metalFramebufferOnly: 0 103 | xboxOneResolution: 0 104 | xboxOneSResolution: 0 105 | xboxOneXResolution: 3 106 | xboxOneMonoLoggingLevel: 0 107 | xboxOneLoggingLevel: 1 108 | xboxOneDisableEsram: 0 109 | xboxOnePresentImmediateThreshold: 0 110 | switchQueueCommandMemory: 0 111 | switchQueueControlMemory: 16384 112 | switchQueueComputeMemory: 262144 113 | switchNVNShaderPoolsGranularity: 33554432 114 | switchNVNDefaultPoolsGranularity: 16777216 115 | switchNVNOtherPoolsGranularity: 16777216 116 | vulkanEnableSetSRGBWrite: 0 117 | m_SupportedAspectRatios: 118 | 4:3: 1 119 | 5:4: 1 120 | 16:10: 1 121 | 16:9: 1 122 | Others: 1 123 | bundleVersion: 1.0 124 | preloadedAssets: [] 125 | metroInputSource: 0 126 | wsaTransparentSwapchain: 0 127 | m_HolographicPauseOnTrackingLoss: 1 128 | xboxOneDisableKinectGpuReservation: 1 129 | xboxOneEnable7thCore: 1 130 | vrSettings: 131 | cardboard: 132 | depthFormat: 0 133 | enableTransitionView: 0 134 | daydream: 135 | depthFormat: 0 136 | useSustainedPerformanceMode: 0 137 | enableVideoLayer: 0 138 | useProtectedVideoMemory: 0 139 | minimumSupportedHeadTracking: 0 140 | maximumSupportedHeadTracking: 1 141 | hololens: 142 | depthFormat: 1 143 | depthBufferSharingEnabled: 1 144 | lumin: 145 | depthFormat: 0 146 | frameTiming: 2 147 | enableGLCache: 0 148 | glCacheMaxBlobSize: 524288 149 | glCacheMaxFileSize: 8388608 150 | oculus: 151 | sharedDepthBuffer: 1 152 | dashSupport: 1 153 | lowOverheadMode: 0 154 | enable360StereoCapture: 0 155 | isWsaHolographicRemotingEnabled: 0 156 | protectGraphicsMemory: 0 157 | enableFrameTimingStats: 0 158 | useHDRDisplay: 0 159 | m_ColorGamuts: 00000000 160 | targetPixelDensity: 30 161 | resolutionScalingMode: 0 162 | androidSupportedAspectRatio: 1 163 | androidMaxAspectRatio: 2.1 164 | applicationIdentifier: {} 165 | buildNumber: {} 166 | AndroidBundleVersionCode: 1 167 | AndroidMinSdkVersion: 16 168 | AndroidTargetSdkVersion: 0 169 | AndroidPreferredInstallLocation: 1 170 | aotOptions: 171 | stripEngineCode: 1 172 | iPhoneStrippingLevel: 0 173 | iPhoneScriptCallOptimization: 0 174 | ForceInternetPermission: 0 175 | ForceSDCardPermission: 0 176 | CreateWallpaper: 0 177 | APKExpansionFiles: 0 178 | keepLoadedShadersAlive: 0 179 | StripUnusedMeshComponents: 1 180 | VertexChannelCompressionMask: 4054 181 | iPhoneSdkVersion: 988 182 | iOSTargetOSVersionString: 9.0 183 | tvOSSdkVersion: 0 184 | tvOSRequireExtendedGameController: 0 185 | tvOSTargetOSVersionString: 9.0 186 | uIPrerenderedIcon: 0 187 | uIRequiresPersistentWiFi: 0 188 | uIRequiresFullScreen: 1 189 | uIStatusBarHidden: 1 190 | uIExitOnSuspend: 0 191 | uIStatusBarStyle: 0 192 | iPhoneSplashScreen: {fileID: 0} 193 | iPhoneHighResSplashScreen: {fileID: 0} 194 | iPhoneTallHighResSplashScreen: {fileID: 0} 195 | iPhone47inSplashScreen: {fileID: 0} 196 | iPhone55inPortraitSplashScreen: {fileID: 0} 197 | iPhone55inLandscapeSplashScreen: {fileID: 0} 198 | iPhone58inPortraitSplashScreen: {fileID: 0} 199 | iPhone58inLandscapeSplashScreen: {fileID: 0} 200 | iPadPortraitSplashScreen: {fileID: 0} 201 | iPadHighResPortraitSplashScreen: {fileID: 0} 202 | iPadLandscapeSplashScreen: {fileID: 0} 203 | iPadHighResLandscapeSplashScreen: {fileID: 0} 204 | iPhone65inPortraitSplashScreen: {fileID: 0} 205 | iPhone65inLandscapeSplashScreen: {fileID: 0} 206 | iPhone61inPortraitSplashScreen: {fileID: 0} 207 | iPhone61inLandscapeSplashScreen: {fileID: 0} 208 | appleTVSplashScreen: {fileID: 0} 209 | appleTVSplashScreen2x: {fileID: 0} 210 | tvOSSmallIconLayers: [] 211 | tvOSSmallIconLayers2x: [] 212 | tvOSLargeIconLayers: [] 213 | tvOSLargeIconLayers2x: [] 214 | tvOSTopShelfImageLayers: [] 215 | tvOSTopShelfImageLayers2x: [] 216 | tvOSTopShelfImageWideLayers: [] 217 | tvOSTopShelfImageWideLayers2x: [] 218 | iOSLaunchScreenType: 0 219 | iOSLaunchScreenPortrait: {fileID: 0} 220 | iOSLaunchScreenLandscape: {fileID: 0} 221 | iOSLaunchScreenBackgroundColor: 222 | serializedVersion: 2 223 | rgba: 0 224 | iOSLaunchScreenFillPct: 100 225 | iOSLaunchScreenSize: 100 226 | iOSLaunchScreenCustomXibPath: 227 | iOSLaunchScreeniPadType: 0 228 | iOSLaunchScreeniPadImage: {fileID: 0} 229 | iOSLaunchScreeniPadBackgroundColor: 230 | serializedVersion: 2 231 | rgba: 0 232 | iOSLaunchScreeniPadFillPct: 100 233 | iOSLaunchScreeniPadSize: 100 234 | iOSLaunchScreeniPadCustomXibPath: 235 | iOSUseLaunchScreenStoryboard: 0 236 | iOSLaunchScreenCustomStoryboardPath: 237 | iOSDeviceRequirements: [] 238 | iOSURLSchemes: [] 239 | iOSBackgroundModes: 0 240 | iOSMetalForceHardShadows: 0 241 | metalEditorSupport: 1 242 | metalAPIValidation: 1 243 | iOSRenderExtraFrameOnPause: 0 244 | appleDeveloperTeamID: 245 | iOSManualSigningProvisioningProfileID: 246 | tvOSManualSigningProvisioningProfileID: 247 | iOSManualSigningProvisioningProfileType: 0 248 | tvOSManualSigningProvisioningProfileType: 0 249 | appleEnableAutomaticSigning: 0 250 | iOSRequireARKit: 0 251 | iOSAutomaticallyDetectAndAddCapabilities: 1 252 | appleEnableProMotion: 0 253 | clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea 254 | templatePackageId: com.unity.template.3d@3.1.0 255 | templateDefaultScene: Assets/Scenes/SampleScene.unity 256 | AndroidTargetArchitectures: 1 257 | AndroidSplashScreenScale: 0 258 | androidSplashScreen: {fileID: 0} 259 | AndroidKeystoreName: '{inproject}: ' 260 | AndroidKeyaliasName: 261 | AndroidBuildApkPerCpuArchitecture: 0 262 | AndroidTVCompatibility: 0 263 | AndroidIsGame: 1 264 | AndroidEnableTango: 0 265 | androidEnableBanner: 1 266 | androidUseLowAccuracyLocation: 0 267 | androidUseCustomKeystore: 0 268 | m_AndroidBanners: 269 | - width: 320 270 | height: 180 271 | banner: {fileID: 0} 272 | androidGamepadSupportLevel: 0 273 | AndroidValidateAppBundleSize: 1 274 | AndroidAppBundleSizeToValidate: 150 275 | resolutionDialogBanner: {fileID: 0} 276 | m_BuildTargetIcons: [] 277 | m_BuildTargetPlatformIcons: [] 278 | m_BuildTargetBatching: 279 | - m_BuildTarget: Standalone 280 | m_StaticBatching: 1 281 | m_DynamicBatching: 0 282 | - m_BuildTarget: tvOS 283 | m_StaticBatching: 1 284 | m_DynamicBatching: 0 285 | - m_BuildTarget: Android 286 | m_StaticBatching: 1 287 | m_DynamicBatching: 0 288 | - m_BuildTarget: iPhone 289 | m_StaticBatching: 1 290 | m_DynamicBatching: 0 291 | - m_BuildTarget: WebGL 292 | m_StaticBatching: 0 293 | m_DynamicBatching: 0 294 | m_BuildTargetGraphicsAPIs: 295 | - m_BuildTarget: AndroidPlayer 296 | m_APIs: 150000000b000000 297 | m_Automatic: 0 298 | - m_BuildTarget: iOSSupport 299 | m_APIs: 10000000 300 | m_Automatic: 1 301 | - m_BuildTarget: AppleTVSupport 302 | m_APIs: 10000000 303 | m_Automatic: 0 304 | - m_BuildTarget: WebGLSupport 305 | m_APIs: 0b000000 306 | m_Automatic: 1 307 | m_BuildTargetVRSettings: 308 | - m_BuildTarget: Standalone 309 | m_Enabled: 0 310 | m_Devices: 311 | - Oculus 312 | - OpenVR 313 | openGLRequireES31: 0 314 | openGLRequireES31AEP: 0 315 | openGLRequireES32: 0 316 | vuforiaEnabled: 0 317 | m_TemplateCustomTags: {} 318 | mobileMTRendering: 319 | Android: 1 320 | iPhone: 1 321 | tvOS: 1 322 | m_BuildTargetGroupLightmapEncodingQuality: [] 323 | m_BuildTargetGroupLightmapSettings: [] 324 | playModeTestRunnerEnabled: 0 325 | runPlayModeTestAsEditModeTest: 0 326 | actionOnDotNetUnhandledException: 1 327 | enableInternalProfiler: 0 328 | logObjCUncaughtExceptions: 1 329 | enableCrashReportAPI: 0 330 | cameraUsageDescription: 331 | locationUsageDescription: 332 | microphoneUsageDescription: 333 | switchNetLibKey: 334 | switchSocketMemoryPoolSize: 6144 335 | switchSocketAllocatorPoolSize: 128 336 | switchSocketConcurrencyLimit: 14 337 | switchScreenResolutionBehavior: 2 338 | switchUseCPUProfiler: 0 339 | switchApplicationID: 0x01004b9000490000 340 | switchNSODependencies: 341 | switchTitleNames_0: 342 | switchTitleNames_1: 343 | switchTitleNames_2: 344 | switchTitleNames_3: 345 | switchTitleNames_4: 346 | switchTitleNames_5: 347 | switchTitleNames_6: 348 | switchTitleNames_7: 349 | switchTitleNames_8: 350 | switchTitleNames_9: 351 | switchTitleNames_10: 352 | switchTitleNames_11: 353 | switchTitleNames_12: 354 | switchTitleNames_13: 355 | switchTitleNames_14: 356 | switchPublisherNames_0: 357 | switchPublisherNames_1: 358 | switchPublisherNames_2: 359 | switchPublisherNames_3: 360 | switchPublisherNames_4: 361 | switchPublisherNames_5: 362 | switchPublisherNames_6: 363 | switchPublisherNames_7: 364 | switchPublisherNames_8: 365 | switchPublisherNames_9: 366 | switchPublisherNames_10: 367 | switchPublisherNames_11: 368 | switchPublisherNames_12: 369 | switchPublisherNames_13: 370 | switchPublisherNames_14: 371 | switchIcons_0: {fileID: 0} 372 | switchIcons_1: {fileID: 0} 373 | switchIcons_2: {fileID: 0} 374 | switchIcons_3: {fileID: 0} 375 | switchIcons_4: {fileID: 0} 376 | switchIcons_5: {fileID: 0} 377 | switchIcons_6: {fileID: 0} 378 | switchIcons_7: {fileID: 0} 379 | switchIcons_8: {fileID: 0} 380 | switchIcons_9: {fileID: 0} 381 | switchIcons_10: {fileID: 0} 382 | switchIcons_11: {fileID: 0} 383 | switchIcons_12: {fileID: 0} 384 | switchIcons_13: {fileID: 0} 385 | switchIcons_14: {fileID: 0} 386 | switchSmallIcons_0: {fileID: 0} 387 | switchSmallIcons_1: {fileID: 0} 388 | switchSmallIcons_2: {fileID: 0} 389 | switchSmallIcons_3: {fileID: 0} 390 | switchSmallIcons_4: {fileID: 0} 391 | switchSmallIcons_5: {fileID: 0} 392 | switchSmallIcons_6: {fileID: 0} 393 | switchSmallIcons_7: {fileID: 0} 394 | switchSmallIcons_8: {fileID: 0} 395 | switchSmallIcons_9: {fileID: 0} 396 | switchSmallIcons_10: {fileID: 0} 397 | switchSmallIcons_11: {fileID: 0} 398 | switchSmallIcons_12: {fileID: 0} 399 | switchSmallIcons_13: {fileID: 0} 400 | switchSmallIcons_14: {fileID: 0} 401 | switchManualHTML: 402 | switchAccessibleURLs: 403 | switchLegalInformation: 404 | switchMainThreadStackSize: 1048576 405 | switchPresenceGroupId: 406 | switchLogoHandling: 0 407 | switchReleaseVersion: 0 408 | switchDisplayVersion: 1.0.0 409 | switchStartupUserAccount: 0 410 | switchTouchScreenUsage: 0 411 | switchSupportedLanguagesMask: 0 412 | switchLogoType: 0 413 | switchApplicationErrorCodeCategory: 414 | switchUserAccountSaveDataSize: 0 415 | switchUserAccountSaveDataJournalSize: 0 416 | switchApplicationAttribute: 0 417 | switchCardSpecSize: -1 418 | switchCardSpecClock: -1 419 | switchRatingsMask: 0 420 | switchRatingsInt_0: 0 421 | switchRatingsInt_1: 0 422 | switchRatingsInt_2: 0 423 | switchRatingsInt_3: 0 424 | switchRatingsInt_4: 0 425 | switchRatingsInt_5: 0 426 | switchRatingsInt_6: 0 427 | switchRatingsInt_7: 0 428 | switchRatingsInt_8: 0 429 | switchRatingsInt_9: 0 430 | switchRatingsInt_10: 0 431 | switchRatingsInt_11: 0 432 | switchLocalCommunicationIds_0: 433 | switchLocalCommunicationIds_1: 434 | switchLocalCommunicationIds_2: 435 | switchLocalCommunicationIds_3: 436 | switchLocalCommunicationIds_4: 437 | switchLocalCommunicationIds_5: 438 | switchLocalCommunicationIds_6: 439 | switchLocalCommunicationIds_7: 440 | switchParentalControl: 0 441 | switchAllowsScreenshot: 1 442 | switchAllowsVideoCapturing: 1 443 | switchAllowsRuntimeAddOnContentInstall: 0 444 | switchDataLossConfirmation: 0 445 | switchUserAccountLockEnabled: 0 446 | switchSystemResourceMemory: 16777216 447 | switchSupportedNpadStyles: 3 448 | switchNativeFsCacheSize: 32 449 | switchIsHoldTypeHorizontal: 0 450 | switchSupportedNpadCount: 8 451 | switchSocketConfigEnabled: 0 452 | switchTcpInitialSendBufferSize: 32 453 | switchTcpInitialReceiveBufferSize: 64 454 | switchTcpAutoSendBufferSizeMax: 256 455 | switchTcpAutoReceiveBufferSizeMax: 256 456 | switchUdpSendBufferSize: 9 457 | switchUdpReceiveBufferSize: 42 458 | switchSocketBufferEfficiency: 4 459 | switchSocketInitializeEnabled: 1 460 | switchNetworkInterfaceManagerInitializeEnabled: 1 461 | switchPlayerConnectionEnabled: 1 462 | ps4NPAgeRating: 12 463 | ps4NPTitleSecret: 464 | ps4NPTrophyPackPath: 465 | ps4ParentalLevel: 11 466 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 467 | ps4Category: 0 468 | ps4MasterVersion: 01.00 469 | ps4AppVersion: 01.00 470 | ps4AppType: 0 471 | ps4ParamSfxPath: 472 | ps4VideoOutPixelFormat: 0 473 | ps4VideoOutInitialWidth: 1920 474 | ps4VideoOutBaseModeInitialWidth: 1920 475 | ps4VideoOutReprojectionRate: 60 476 | ps4PronunciationXMLPath: 477 | ps4PronunciationSIGPath: 478 | ps4BackgroundImagePath: 479 | ps4StartupImagePath: 480 | ps4StartupImagesFolder: 481 | ps4IconImagesFolder: 482 | ps4SaveDataImagePath: 483 | ps4SdkOverride: 484 | ps4BGMPath: 485 | ps4ShareFilePath: 486 | ps4ShareOverlayImagePath: 487 | ps4PrivacyGuardImagePath: 488 | ps4NPtitleDatPath: 489 | ps4RemotePlayKeyAssignment: -1 490 | ps4RemotePlayKeyMappingDir: 491 | ps4PlayTogetherPlayerCount: 0 492 | ps4EnterButtonAssignment: 1 493 | ps4ApplicationParam1: 0 494 | ps4ApplicationParam2: 0 495 | ps4ApplicationParam3: 0 496 | ps4ApplicationParam4: 0 497 | ps4DownloadDataSize: 0 498 | ps4GarlicHeapSize: 2048 499 | ps4ProGarlicHeapSize: 2560 500 | playerPrefsMaxSize: 32768 501 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 502 | ps4pnSessions: 1 503 | ps4pnPresence: 1 504 | ps4pnFriends: 1 505 | ps4pnGameCustomData: 1 506 | playerPrefsSupport: 0 507 | enableApplicationExit: 0 508 | resetTempFolder: 1 509 | restrictedAudioUsageRights: 0 510 | ps4UseResolutionFallback: 0 511 | ps4ReprojectionSupport: 0 512 | ps4UseAudio3dBackend: 0 513 | ps4SocialScreenEnabled: 0 514 | ps4ScriptOptimizationLevel: 0 515 | ps4Audio3dVirtualSpeakerCount: 14 516 | ps4attribCpuUsage: 0 517 | ps4PatchPkgPath: 518 | ps4PatchLatestPkgPath: 519 | ps4PatchChangeinfoPath: 520 | ps4PatchDayOne: 0 521 | ps4attribUserManagement: 0 522 | ps4attribMoveSupport: 0 523 | ps4attrib3DSupport: 0 524 | ps4attribShareSupport: 0 525 | ps4attribExclusiveVR: 0 526 | ps4disableAutoHideSplash: 0 527 | ps4videoRecordingFeaturesUsed: 0 528 | ps4contentSearchFeaturesUsed: 0 529 | ps4attribEyeToEyeDistanceSettingVR: 0 530 | ps4IncludedModules: [] 531 | monoEnv: 532 | splashScreenBackgroundSourceLandscape: {fileID: 0} 533 | splashScreenBackgroundSourcePortrait: {fileID: 0} 534 | blurSplashScreenBackground: 1 535 | spritePackerPolicy: 536 | webGLMemorySize: 16 537 | webGLExceptionSupport: 1 538 | webGLNameFilesAsHashes: 0 539 | webGLDataCaching: 1 540 | webGLDebugSymbols: 0 541 | webGLEmscriptenArgs: 542 | webGLModulesDirectory: 543 | webGLTemplate: APPLICATION:Default 544 | webGLAnalyzeBuildSize: 0 545 | webGLUseEmbeddedResources: 0 546 | webGLCompressionFormat: 1 547 | webGLLinkerTarget: 1 548 | webGLThreadsSupport: 0 549 | webGLWasmStreaming: 0 550 | scriptingDefineSymbols: {} 551 | platformArchitecture: {} 552 | scriptingBackend: {} 553 | il2cppCompilerConfiguration: {} 554 | managedStrippingLevel: {} 555 | incrementalIl2cppBuild: {} 556 | allowUnsafeCode: 0 557 | additionalIl2CppArgs: 558 | scriptingRuntimeVersion: 1 559 | gcIncremental: 0 560 | gcWBarrierValidation: 0 561 | apiCompatibilityLevelPerPlatform: 562 | WebGL: 3 563 | m_RenderingPath: 1 564 | m_MobileRenderingPath: 1 565 | metroPackageName: Template_3D 566 | metroPackageVersion: 567 | metroCertificatePath: 568 | metroCertificatePassword: 569 | metroCertificateSubject: 570 | metroCertificateIssuer: 571 | metroCertificateNotAfter: 0000000000000000 572 | metroApplicationDescription: Template_3D 573 | wsaImages: {} 574 | metroTileShortName: 575 | metroTileShowName: 0 576 | metroMediumTileShowName: 0 577 | metroLargeTileShowName: 0 578 | metroWideTileShowName: 0 579 | metroSupportStreamingInstall: 0 580 | metroLastRequiredScene: 0 581 | metroDefaultTileSize: 1 582 | metroTileForegroundText: 2 583 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 584 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 585 | a: 1} 586 | metroSplashScreenUseBackgroundColor: 0 587 | platformCapabilities: {} 588 | metroTargetDeviceFamilies: {} 589 | metroFTAName: 590 | metroFTAFileTypes: [] 591 | metroProtocolName: 592 | XboxOneProductId: 593 | XboxOneUpdateKey: 594 | XboxOneSandboxId: 595 | XboxOneContentId: 596 | XboxOneTitleId: 597 | XboxOneSCId: 598 | XboxOneGameOsOverridePath: 599 | XboxOnePackagingOverridePath: 600 | XboxOneAppManifestOverridePath: 601 | XboxOneVersion: 1.0.0.0 602 | XboxOnePackageEncryption: 0 603 | XboxOnePackageUpdateGranularity: 2 604 | XboxOneDescription: 605 | XboxOneLanguage: 606 | - enus 607 | XboxOneCapability: [] 608 | XboxOneGameRating: {} 609 | XboxOneIsContentPackage: 0 610 | XboxOneEnableGPUVariability: 1 611 | XboxOneSockets: {} 612 | XboxOneSplashScreen: {fileID: 0} 613 | XboxOneAllowedProductIds: [] 614 | XboxOnePersistentLocalStorageSize: 0 615 | XboxOneXTitleMemory: 8 616 | xboxOneScriptCompiler: 1 617 | XboxOneOverrideIdentityName: 618 | vrEditorSettings: 619 | daydream: 620 | daydreamIconForeground: {fileID: 0} 621 | daydreamIconBackground: {fileID: 0} 622 | cloudServicesEnabled: 623 | UNet: 1 624 | luminIcon: 625 | m_Name: 626 | m_ModelFolderPath: 627 | m_PortalFolderPath: 628 | luminCert: 629 | m_CertPath: 630 | m_SignPackage: 1 631 | luminIsChannelApp: 0 632 | luminVersion: 633 | m_VersionCode: 1 634 | m_VersionName: 635 | facebookSdkVersion: 7.9.4 636 | facebookAppId: 637 | facebookCookies: 1 638 | facebookLogging: 1 639 | facebookStatus: 1 640 | facebookXfbml: 0 641 | facebookFrictionlessRequests: 1 642 | apiCompatibilityLevel: 6 643 | cloudProjectId: 644 | framebufferDepthMemorylessMode: 0 645 | projectName: 646 | organizationId: 647 | cloudEnabled: 0 648 | enableNativePlatformBackendsForNewInputSystem: 0 649 | disableOldInputManagerSupport: 0 650 | legacyClampBlendShapeWeights: 1 651 | -------------------------------------------------------------------------------- /NativeWebSocket/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2021.2.11f1 2 | m_EditorVersionWithRevision: 2021.2.11f1 (e50cafbb4399) 3 | -------------------------------------------------------------------------------- /NativeWebSocket/ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | streamingMipmapsActive: 0 33 | streamingMipmapsAddAllCameras: 1 34 | streamingMipmapsMemoryBudget: 512 35 | streamingMipmapsRenderersPerFrame: 512 36 | streamingMipmapsMaxLevelReduction: 2 37 | streamingMipmapsMaxFileIORequests: 1024 38 | particleRaycastBudget: 4 39 | asyncUploadTimeSlice: 2 40 | asyncUploadBufferSize: 16 41 | asyncUploadPersistentBuffer: 1 42 | resolutionScalingFixedDPIFactor: 1 43 | excludedTargetPlatforms: [] 44 | - serializedVersion: 2 45 | name: Low 46 | pixelLightCount: 0 47 | shadows: 0 48 | shadowResolution: 0 49 | shadowProjection: 1 50 | shadowCascades: 1 51 | shadowDistance: 20 52 | shadowNearPlaneOffset: 3 53 | shadowCascade2Split: 0.33333334 54 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 55 | shadowmaskMode: 0 56 | blendWeights: 2 57 | textureQuality: 0 58 | anisotropicTextures: 0 59 | antiAliasing: 0 60 | softParticles: 0 61 | softVegetation: 0 62 | realtimeReflectionProbes: 0 63 | billboardsFaceCameraPosition: 0 64 | vSyncCount: 0 65 | lodBias: 0.4 66 | maximumLODLevel: 0 67 | streamingMipmapsActive: 0 68 | streamingMipmapsAddAllCameras: 1 69 | streamingMipmapsMemoryBudget: 512 70 | streamingMipmapsRenderersPerFrame: 512 71 | streamingMipmapsMaxLevelReduction: 2 72 | streamingMipmapsMaxFileIORequests: 1024 73 | particleRaycastBudget: 16 74 | asyncUploadTimeSlice: 2 75 | asyncUploadBufferSize: 16 76 | asyncUploadPersistentBuffer: 1 77 | resolutionScalingFixedDPIFactor: 1 78 | excludedTargetPlatforms: [] 79 | - serializedVersion: 2 80 | name: Medium 81 | pixelLightCount: 1 82 | shadows: 1 83 | shadowResolution: 0 84 | shadowProjection: 1 85 | shadowCascades: 1 86 | shadowDistance: 20 87 | shadowNearPlaneOffset: 3 88 | shadowCascade2Split: 0.33333334 89 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 90 | shadowmaskMode: 0 91 | blendWeights: 2 92 | textureQuality: 0 93 | anisotropicTextures: 1 94 | antiAliasing: 0 95 | softParticles: 0 96 | softVegetation: 0 97 | realtimeReflectionProbes: 0 98 | billboardsFaceCameraPosition: 0 99 | vSyncCount: 1 100 | lodBias: 0.7 101 | maximumLODLevel: 0 102 | streamingMipmapsActive: 0 103 | streamingMipmapsAddAllCameras: 1 104 | streamingMipmapsMemoryBudget: 512 105 | streamingMipmapsRenderersPerFrame: 512 106 | streamingMipmapsMaxLevelReduction: 2 107 | streamingMipmapsMaxFileIORequests: 1024 108 | particleRaycastBudget: 64 109 | asyncUploadTimeSlice: 2 110 | asyncUploadBufferSize: 16 111 | asyncUploadPersistentBuffer: 1 112 | resolutionScalingFixedDPIFactor: 1 113 | excludedTargetPlatforms: [] 114 | - serializedVersion: 2 115 | name: High 116 | pixelLightCount: 2 117 | shadows: 2 118 | shadowResolution: 1 119 | shadowProjection: 1 120 | shadowCascades: 2 121 | shadowDistance: 40 122 | shadowNearPlaneOffset: 3 123 | shadowCascade2Split: 0.33333334 124 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 125 | shadowmaskMode: 1 126 | blendWeights: 2 127 | textureQuality: 0 128 | anisotropicTextures: 1 129 | antiAliasing: 0 130 | softParticles: 0 131 | softVegetation: 1 132 | realtimeReflectionProbes: 1 133 | billboardsFaceCameraPosition: 1 134 | vSyncCount: 1 135 | lodBias: 1 136 | maximumLODLevel: 0 137 | streamingMipmapsActive: 0 138 | streamingMipmapsAddAllCameras: 1 139 | streamingMipmapsMemoryBudget: 512 140 | streamingMipmapsRenderersPerFrame: 512 141 | streamingMipmapsMaxLevelReduction: 2 142 | streamingMipmapsMaxFileIORequests: 1024 143 | particleRaycastBudget: 256 144 | asyncUploadTimeSlice: 2 145 | asyncUploadBufferSize: 16 146 | asyncUploadPersistentBuffer: 1 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Very High 151 | pixelLightCount: 3 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 2 156 | shadowDistance: 70 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 2 164 | antiAliasing: 2 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 1.5 171 | maximumLODLevel: 0 172 | streamingMipmapsActive: 0 173 | streamingMipmapsAddAllCameras: 1 174 | streamingMipmapsMemoryBudget: 512 175 | streamingMipmapsRenderersPerFrame: 512 176 | streamingMipmapsMaxLevelReduction: 2 177 | streamingMipmapsMaxFileIORequests: 1024 178 | particleRaycastBudget: 1024 179 | asyncUploadTimeSlice: 2 180 | asyncUploadBufferSize: 16 181 | asyncUploadPersistentBuffer: 1 182 | resolutionScalingFixedDPIFactor: 1 183 | excludedTargetPlatforms: [] 184 | - serializedVersion: 2 185 | name: Ultra 186 | pixelLightCount: 4 187 | shadows: 2 188 | shadowResolution: 2 189 | shadowProjection: 1 190 | shadowCascades: 4 191 | shadowDistance: 150 192 | shadowNearPlaneOffset: 3 193 | shadowCascade2Split: 0.33333334 194 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 195 | shadowmaskMode: 1 196 | blendWeights: 4 197 | textureQuality: 0 198 | anisotropicTextures: 2 199 | antiAliasing: 2 200 | softParticles: 1 201 | softVegetation: 1 202 | realtimeReflectionProbes: 1 203 | billboardsFaceCameraPosition: 1 204 | vSyncCount: 1 205 | lodBias: 2 206 | maximumLODLevel: 0 207 | streamingMipmapsActive: 0 208 | streamingMipmapsAddAllCameras: 1 209 | streamingMipmapsMemoryBudget: 512 210 | streamingMipmapsRenderersPerFrame: 512 211 | streamingMipmapsMaxLevelReduction: 2 212 | streamingMipmapsMaxFileIORequests: 1024 213 | particleRaycastBudget: 4096 214 | asyncUploadTimeSlice: 2 215 | asyncUploadBufferSize: 16 216 | asyncUploadPersistentBuffer: 1 217 | resolutionScalingFixedDPIFactor: 1 218 | excludedTargetPlatforms: [] 219 | m_PerPlatformDefaultQuality: 220 | Android: 2 221 | Lumin: 5 222 | Nintendo 3DS: 5 223 | Nintendo Switch: 5 224 | PS4: 5 225 | PSP2: 2 226 | Standalone: 5 227 | WebGL: 3 228 | Windows Store Apps: 5 229 | XboxOne: 5 230 | iPhone: 2 231 | tvOS: 2 232 | -------------------------------------------------------------------------------- /NativeWebSocket/ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /NativeWebSocket/ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /NativeWebSocket/ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | m_InitializeOnStartup: 1 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /NativeWebSocket/ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_StripUpdateShader: {fileID: 0} 10 | m_RenderPipeSettingsPath: 11 | m_FixedTimeStep: 0.016666668 12 | m_MaxDeltaTime: 0.05 13 | m_CompiledVersion: 0 14 | m_RuntimeVersion: 0 15 | -------------------------------------------------------------------------------- /NativeWebSocket/ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /NodeServer/index.js: -------------------------------------------------------------------------------- 1 | const crypto = require('crypto'); 2 | const express = require('express'); 3 | const { createServer } = require('http'); 4 | const WebSocket = require('ws'); 5 | 6 | const app = express(); 7 | const port = 3000; 8 | 9 | const server = createServer(app); 10 | const wss = new WebSocket.Server({ server }); 11 | 12 | wss.on('connection', function(ws) { 13 | console.log("client joined."); 14 | 15 | // send "hello world" interval 16 | const textInterval = setInterval(() => ws.send("hello world!"), 100); 17 | 18 | // send random bytes interval 19 | const binaryInterval = setInterval(() => ws.send(crypto.randomBytes(8).buffer), 110); 20 | 21 | ws.on('message', function(data) { 22 | if (typeof(data) === "string") { 23 | // client sent a string 24 | console.log("string received from client -> '" + data + "'"); 25 | 26 | } else { 27 | console.log("binary received from client -> " + Array.from(data).join(", ") + ""); 28 | } 29 | }); 30 | 31 | ws.on('close', function() { 32 | console.log("client left."); 33 | clearInterval(textInterval); 34 | clearInterval(binaryInterval); 35 | }); 36 | }); 37 | 38 | server.listen(port, function() { 39 | console.log(`Listening on http://localhost:${port}`); 40 | }); 41 | -------------------------------------------------------------------------------- /NodeServer/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nodeserver", 3 | "version": "1.0.0", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "nodeserver", 9 | "version": "1.0.0", 10 | "license": "ISC", 11 | "dependencies": { 12 | "express": "^4.17.1", 13 | "ws": "^7.1.2" 14 | }, 15 | "engines": { 16 | "node": "12.x" 17 | } 18 | }, 19 | "node_modules/accepts": { 20 | "version": "1.3.7", 21 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", 22 | "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", 23 | "dependencies": { 24 | "mime-types": "~2.1.24", 25 | "negotiator": "0.6.2" 26 | }, 27 | "engines": { 28 | "node": ">= 0.6" 29 | } 30 | }, 31 | "node_modules/array-flatten": { 32 | "version": "1.1.1", 33 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 34 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" 35 | }, 36 | "node_modules/async-limiter": { 37 | "version": "1.0.1", 38 | "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", 39 | "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" 40 | }, 41 | "node_modules/body-parser": { 42 | "version": "1.19.0", 43 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", 44 | "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", 45 | "dependencies": { 46 | "bytes": "3.1.0", 47 | "content-type": "~1.0.4", 48 | "debug": "2.6.9", 49 | "depd": "~1.1.2", 50 | "http-errors": "1.7.2", 51 | "iconv-lite": "0.4.24", 52 | "on-finished": "~2.3.0", 53 | "qs": "6.7.0", 54 | "raw-body": "2.4.0", 55 | "type-is": "~1.6.17" 56 | }, 57 | "engines": { 58 | "node": ">= 0.8" 59 | } 60 | }, 61 | "node_modules/bytes": { 62 | "version": "3.1.0", 63 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", 64 | "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==", 65 | "engines": { 66 | "node": ">= 0.8" 67 | } 68 | }, 69 | "node_modules/content-disposition": { 70 | "version": "0.5.3", 71 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", 72 | "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", 73 | "dependencies": { 74 | "safe-buffer": "5.1.2" 75 | }, 76 | "engines": { 77 | "node": ">= 0.6" 78 | } 79 | }, 80 | "node_modules/content-type": { 81 | "version": "1.0.4", 82 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", 83 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==", 84 | "engines": { 85 | "node": ">= 0.6" 86 | } 87 | }, 88 | "node_modules/cookie": { 89 | "version": "0.4.0", 90 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", 91 | "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==", 92 | "engines": { 93 | "node": ">= 0.6" 94 | } 95 | }, 96 | "node_modules/cookie-signature": { 97 | "version": "1.0.6", 98 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 99 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" 100 | }, 101 | "node_modules/debug": { 102 | "version": "2.6.9", 103 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 104 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 105 | "dependencies": { 106 | "ms": "2.0.0" 107 | } 108 | }, 109 | "node_modules/depd": { 110 | "version": "1.1.2", 111 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", 112 | "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", 113 | "engines": { 114 | "node": ">= 0.6" 115 | } 116 | }, 117 | "node_modules/destroy": { 118 | "version": "1.0.4", 119 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", 120 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" 121 | }, 122 | "node_modules/ee-first": { 123 | "version": "1.1.1", 124 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 125 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" 126 | }, 127 | "node_modules/encodeurl": { 128 | "version": "1.0.2", 129 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 130 | "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=", 131 | "engines": { 132 | "node": ">= 0.8" 133 | } 134 | }, 135 | "node_modules/escape-html": { 136 | "version": "1.0.3", 137 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 138 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" 139 | }, 140 | "node_modules/etag": { 141 | "version": "1.8.1", 142 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", 143 | "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=", 144 | "engines": { 145 | "node": ">= 0.6" 146 | } 147 | }, 148 | "node_modules/express": { 149 | "version": "4.17.1", 150 | "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", 151 | "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", 152 | "dependencies": { 153 | "accepts": "~1.3.7", 154 | "array-flatten": "1.1.1", 155 | "body-parser": "1.19.0", 156 | "content-disposition": "0.5.3", 157 | "content-type": "~1.0.4", 158 | "cookie": "0.4.0", 159 | "cookie-signature": "1.0.6", 160 | "debug": "2.6.9", 161 | "depd": "~1.1.2", 162 | "encodeurl": "~1.0.2", 163 | "escape-html": "~1.0.3", 164 | "etag": "~1.8.1", 165 | "finalhandler": "~1.1.2", 166 | "fresh": "0.5.2", 167 | "merge-descriptors": "1.0.1", 168 | "methods": "~1.1.2", 169 | "on-finished": "~2.3.0", 170 | "parseurl": "~1.3.3", 171 | "path-to-regexp": "0.1.7", 172 | "proxy-addr": "~2.0.5", 173 | "qs": "6.7.0", 174 | "range-parser": "~1.2.1", 175 | "safe-buffer": "5.1.2", 176 | "send": "0.17.1", 177 | "serve-static": "1.14.1", 178 | "setprototypeof": "1.1.1", 179 | "statuses": "~1.5.0", 180 | "type-is": "~1.6.18", 181 | "utils-merge": "1.0.1", 182 | "vary": "~1.1.2" 183 | }, 184 | "engines": { 185 | "node": ">= 0.10.0" 186 | } 187 | }, 188 | "node_modules/finalhandler": { 189 | "version": "1.1.2", 190 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", 191 | "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", 192 | "dependencies": { 193 | "debug": "2.6.9", 194 | "encodeurl": "~1.0.2", 195 | "escape-html": "~1.0.3", 196 | "on-finished": "~2.3.0", 197 | "parseurl": "~1.3.3", 198 | "statuses": "~1.5.0", 199 | "unpipe": "~1.0.0" 200 | }, 201 | "engines": { 202 | "node": ">= 0.8" 203 | } 204 | }, 205 | "node_modules/forwarded": { 206 | "version": "0.1.2", 207 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", 208 | "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=", 209 | "engines": { 210 | "node": ">= 0.6" 211 | } 212 | }, 213 | "node_modules/fresh": { 214 | "version": "0.5.2", 215 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", 216 | "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=", 217 | "engines": { 218 | "node": ">= 0.6" 219 | } 220 | }, 221 | "node_modules/http-errors": { 222 | "version": "1.7.2", 223 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", 224 | "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", 225 | "dependencies": { 226 | "depd": "~1.1.2", 227 | "inherits": "2.0.3", 228 | "setprototypeof": "1.1.1", 229 | "statuses": ">= 1.5.0 < 2", 230 | "toidentifier": "1.0.0" 231 | }, 232 | "engines": { 233 | "node": ">= 0.6" 234 | } 235 | }, 236 | "node_modules/iconv-lite": { 237 | "version": "0.4.24", 238 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 239 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", 240 | "dependencies": { 241 | "safer-buffer": ">= 2.1.2 < 3" 242 | }, 243 | "engines": { 244 | "node": ">=0.10.0" 245 | } 246 | }, 247 | "node_modules/inherits": { 248 | "version": "2.0.3", 249 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 250 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 251 | }, 252 | "node_modules/ipaddr.js": { 253 | "version": "1.9.0", 254 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz", 255 | "integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA==", 256 | "engines": { 257 | "node": ">= 0.10" 258 | } 259 | }, 260 | "node_modules/media-typer": { 261 | "version": "0.3.0", 262 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 263 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", 264 | "engines": { 265 | "node": ">= 0.6" 266 | } 267 | }, 268 | "node_modules/merge-descriptors": { 269 | "version": "1.0.1", 270 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 271 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" 272 | }, 273 | "node_modules/methods": { 274 | "version": "1.1.2", 275 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 276 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=", 277 | "engines": { 278 | "node": ">= 0.6" 279 | } 280 | }, 281 | "node_modules/mime": { 282 | "version": "1.6.0", 283 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 284 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", 285 | "bin": { 286 | "mime": "cli.js" 287 | }, 288 | "engines": { 289 | "node": ">=4" 290 | } 291 | }, 292 | "node_modules/mime-db": { 293 | "version": "1.40.0", 294 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", 295 | "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==", 296 | "engines": { 297 | "node": ">= 0.6" 298 | } 299 | }, 300 | "node_modules/mime-types": { 301 | "version": "2.1.24", 302 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", 303 | "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", 304 | "dependencies": { 305 | "mime-db": "1.40.0" 306 | }, 307 | "engines": { 308 | "node": ">= 0.6" 309 | } 310 | }, 311 | "node_modules/ms": { 312 | "version": "2.0.0", 313 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 314 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 315 | }, 316 | "node_modules/negotiator": { 317 | "version": "0.6.2", 318 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", 319 | "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==", 320 | "engines": { 321 | "node": ">= 0.6" 322 | } 323 | }, 324 | "node_modules/on-finished": { 325 | "version": "2.3.0", 326 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 327 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", 328 | "dependencies": { 329 | "ee-first": "1.1.1" 330 | }, 331 | "engines": { 332 | "node": ">= 0.8" 333 | } 334 | }, 335 | "node_modules/parseurl": { 336 | "version": "1.3.3", 337 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", 338 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", 339 | "engines": { 340 | "node": ">= 0.8" 341 | } 342 | }, 343 | "node_modules/path-to-regexp": { 344 | "version": "0.1.7", 345 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 346 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" 347 | }, 348 | "node_modules/proxy-addr": { 349 | "version": "2.0.5", 350 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz", 351 | "integrity": "sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ==", 352 | "dependencies": { 353 | "forwarded": "~0.1.2", 354 | "ipaddr.js": "1.9.0" 355 | }, 356 | "engines": { 357 | "node": ">= 0.10" 358 | } 359 | }, 360 | "node_modules/qs": { 361 | "version": "6.7.0", 362 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", 363 | "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", 364 | "engines": { 365 | "node": ">=0.6" 366 | } 367 | }, 368 | "node_modules/range-parser": { 369 | "version": "1.2.1", 370 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 371 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", 372 | "engines": { 373 | "node": ">= 0.6" 374 | } 375 | }, 376 | "node_modules/raw-body": { 377 | "version": "2.4.0", 378 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", 379 | "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", 380 | "dependencies": { 381 | "bytes": "3.1.0", 382 | "http-errors": "1.7.2", 383 | "iconv-lite": "0.4.24", 384 | "unpipe": "1.0.0" 385 | }, 386 | "engines": { 387 | "node": ">= 0.8" 388 | } 389 | }, 390 | "node_modules/safe-buffer": { 391 | "version": "5.1.2", 392 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 393 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 394 | }, 395 | "node_modules/safer-buffer": { 396 | "version": "2.1.2", 397 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 398 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 399 | }, 400 | "node_modules/send": { 401 | "version": "0.17.1", 402 | "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", 403 | "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", 404 | "dependencies": { 405 | "debug": "2.6.9", 406 | "depd": "~1.1.2", 407 | "destroy": "~1.0.4", 408 | "encodeurl": "~1.0.2", 409 | "escape-html": "~1.0.3", 410 | "etag": "~1.8.1", 411 | "fresh": "0.5.2", 412 | "http-errors": "~1.7.2", 413 | "mime": "1.6.0", 414 | "ms": "2.1.1", 415 | "on-finished": "~2.3.0", 416 | "range-parser": "~1.2.1", 417 | "statuses": "~1.5.0" 418 | }, 419 | "engines": { 420 | "node": ">= 0.8.0" 421 | } 422 | }, 423 | "node_modules/send/node_modules/ms": { 424 | "version": "2.1.1", 425 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", 426 | "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" 427 | }, 428 | "node_modules/serve-static": { 429 | "version": "1.14.1", 430 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", 431 | "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", 432 | "dependencies": { 433 | "encodeurl": "~1.0.2", 434 | "escape-html": "~1.0.3", 435 | "parseurl": "~1.3.3", 436 | "send": "0.17.1" 437 | }, 438 | "engines": { 439 | "node": ">= 0.8.0" 440 | } 441 | }, 442 | "node_modules/setprototypeof": { 443 | "version": "1.1.1", 444 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", 445 | "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" 446 | }, 447 | "node_modules/statuses": { 448 | "version": "1.5.0", 449 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", 450 | "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=", 451 | "engines": { 452 | "node": ">= 0.6" 453 | } 454 | }, 455 | "node_modules/toidentifier": { 456 | "version": "1.0.0", 457 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", 458 | "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==", 459 | "engines": { 460 | "node": ">=0.6" 461 | } 462 | }, 463 | "node_modules/type-is": { 464 | "version": "1.6.18", 465 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", 466 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", 467 | "dependencies": { 468 | "media-typer": "0.3.0", 469 | "mime-types": "~2.1.24" 470 | }, 471 | "engines": { 472 | "node": ">= 0.6" 473 | } 474 | }, 475 | "node_modules/unpipe": { 476 | "version": "1.0.0", 477 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 478 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=", 479 | "engines": { 480 | "node": ">= 0.8" 481 | } 482 | }, 483 | "node_modules/utils-merge": { 484 | "version": "1.0.1", 485 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 486 | "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", 487 | "engines": { 488 | "node": ">= 0.4.0" 489 | } 490 | }, 491 | "node_modules/vary": { 492 | "version": "1.1.2", 493 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 494 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=", 495 | "engines": { 496 | "node": ">= 0.8" 497 | } 498 | }, 499 | "node_modules/ws": { 500 | "version": "7.1.2", 501 | "resolved": "https://registry.npmjs.org/ws/-/ws-7.1.2.tgz", 502 | "integrity": "sha512-gftXq3XI81cJCgkUiAVixA0raD9IVmXqsylCrjRygw4+UOOGzPoxnQ6r/CnVL9i+mDncJo94tSkyrtuuQVBmrg==", 503 | "dependencies": { 504 | "async-limiter": "^1.0.0" 505 | } 506 | } 507 | }, 508 | "dependencies": { 509 | "accepts": { 510 | "version": "1.3.7", 511 | "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", 512 | "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", 513 | "requires": { 514 | "mime-types": "~2.1.24", 515 | "negotiator": "0.6.2" 516 | } 517 | }, 518 | "array-flatten": { 519 | "version": "1.1.1", 520 | "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", 521 | "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" 522 | }, 523 | "async-limiter": { 524 | "version": "1.0.1", 525 | "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", 526 | "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" 527 | }, 528 | "body-parser": { 529 | "version": "1.19.0", 530 | "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", 531 | "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", 532 | "requires": { 533 | "bytes": "3.1.0", 534 | "content-type": "~1.0.4", 535 | "debug": "2.6.9", 536 | "depd": "~1.1.2", 537 | "http-errors": "1.7.2", 538 | "iconv-lite": "0.4.24", 539 | "on-finished": "~2.3.0", 540 | "qs": "6.7.0", 541 | "raw-body": "2.4.0", 542 | "type-is": "~1.6.17" 543 | } 544 | }, 545 | "bytes": { 546 | "version": "3.1.0", 547 | "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", 548 | "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" 549 | }, 550 | "content-disposition": { 551 | "version": "0.5.3", 552 | "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", 553 | "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", 554 | "requires": { 555 | "safe-buffer": "5.1.2" 556 | } 557 | }, 558 | "content-type": { 559 | "version": "1.0.4", 560 | "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", 561 | "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" 562 | }, 563 | "cookie": { 564 | "version": "0.4.0", 565 | "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", 566 | "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" 567 | }, 568 | "cookie-signature": { 569 | "version": "1.0.6", 570 | "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", 571 | "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" 572 | }, 573 | "debug": { 574 | "version": "2.6.9", 575 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", 576 | "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", 577 | "requires": { 578 | "ms": "2.0.0" 579 | } 580 | }, 581 | "depd": { 582 | "version": "1.1.2", 583 | "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", 584 | "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" 585 | }, 586 | "destroy": { 587 | "version": "1.0.4", 588 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", 589 | "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" 590 | }, 591 | "ee-first": { 592 | "version": "1.1.1", 593 | "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", 594 | "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" 595 | }, 596 | "encodeurl": { 597 | "version": "1.0.2", 598 | "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", 599 | "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" 600 | }, 601 | "escape-html": { 602 | "version": "1.0.3", 603 | "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", 604 | "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" 605 | }, 606 | "etag": { 607 | "version": "1.8.1", 608 | "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", 609 | "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" 610 | }, 611 | "express": { 612 | "version": "4.17.1", 613 | "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", 614 | "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", 615 | "requires": { 616 | "accepts": "~1.3.7", 617 | "array-flatten": "1.1.1", 618 | "body-parser": "1.19.0", 619 | "content-disposition": "0.5.3", 620 | "content-type": "~1.0.4", 621 | "cookie": "0.4.0", 622 | "cookie-signature": "1.0.6", 623 | "debug": "2.6.9", 624 | "depd": "~1.1.2", 625 | "encodeurl": "~1.0.2", 626 | "escape-html": "~1.0.3", 627 | "etag": "~1.8.1", 628 | "finalhandler": "~1.1.2", 629 | "fresh": "0.5.2", 630 | "merge-descriptors": "1.0.1", 631 | "methods": "~1.1.2", 632 | "on-finished": "~2.3.0", 633 | "parseurl": "~1.3.3", 634 | "path-to-regexp": "0.1.7", 635 | "proxy-addr": "~2.0.5", 636 | "qs": "6.7.0", 637 | "range-parser": "~1.2.1", 638 | "safe-buffer": "5.1.2", 639 | "send": "0.17.1", 640 | "serve-static": "1.14.1", 641 | "setprototypeof": "1.1.1", 642 | "statuses": "~1.5.0", 643 | "type-is": "~1.6.18", 644 | "utils-merge": "1.0.1", 645 | "vary": "~1.1.2" 646 | } 647 | }, 648 | "finalhandler": { 649 | "version": "1.1.2", 650 | "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", 651 | "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", 652 | "requires": { 653 | "debug": "2.6.9", 654 | "encodeurl": "~1.0.2", 655 | "escape-html": "~1.0.3", 656 | "on-finished": "~2.3.0", 657 | "parseurl": "~1.3.3", 658 | "statuses": "~1.5.0", 659 | "unpipe": "~1.0.0" 660 | } 661 | }, 662 | "forwarded": { 663 | "version": "0.1.2", 664 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", 665 | "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" 666 | }, 667 | "fresh": { 668 | "version": "0.5.2", 669 | "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", 670 | "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" 671 | }, 672 | "http-errors": { 673 | "version": "1.7.2", 674 | "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", 675 | "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", 676 | "requires": { 677 | "depd": "~1.1.2", 678 | "inherits": "2.0.3", 679 | "setprototypeof": "1.1.1", 680 | "statuses": ">= 1.5.0 < 2", 681 | "toidentifier": "1.0.0" 682 | } 683 | }, 684 | "iconv-lite": { 685 | "version": "0.4.24", 686 | "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", 687 | "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", 688 | "requires": { 689 | "safer-buffer": ">= 2.1.2 < 3" 690 | } 691 | }, 692 | "inherits": { 693 | "version": "2.0.3", 694 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 695 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" 696 | }, 697 | "ipaddr.js": { 698 | "version": "1.9.0", 699 | "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz", 700 | "integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA==" 701 | }, 702 | "media-typer": { 703 | "version": "0.3.0", 704 | "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", 705 | "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" 706 | }, 707 | "merge-descriptors": { 708 | "version": "1.0.1", 709 | "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", 710 | "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" 711 | }, 712 | "methods": { 713 | "version": "1.1.2", 714 | "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", 715 | "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" 716 | }, 717 | "mime": { 718 | "version": "1.6.0", 719 | "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", 720 | "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" 721 | }, 722 | "mime-db": { 723 | "version": "1.40.0", 724 | "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", 725 | "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" 726 | }, 727 | "mime-types": { 728 | "version": "2.1.24", 729 | "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", 730 | "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", 731 | "requires": { 732 | "mime-db": "1.40.0" 733 | } 734 | }, 735 | "ms": { 736 | "version": "2.0.0", 737 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 738 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" 739 | }, 740 | "negotiator": { 741 | "version": "0.6.2", 742 | "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", 743 | "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" 744 | }, 745 | "on-finished": { 746 | "version": "2.3.0", 747 | "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", 748 | "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", 749 | "requires": { 750 | "ee-first": "1.1.1" 751 | } 752 | }, 753 | "parseurl": { 754 | "version": "1.3.3", 755 | "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", 756 | "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" 757 | }, 758 | "path-to-regexp": { 759 | "version": "0.1.7", 760 | "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", 761 | "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" 762 | }, 763 | "proxy-addr": { 764 | "version": "2.0.5", 765 | "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz", 766 | "integrity": "sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ==", 767 | "requires": { 768 | "forwarded": "~0.1.2", 769 | "ipaddr.js": "1.9.0" 770 | } 771 | }, 772 | "qs": { 773 | "version": "6.7.0", 774 | "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", 775 | "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" 776 | }, 777 | "range-parser": { 778 | "version": "1.2.1", 779 | "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", 780 | "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" 781 | }, 782 | "raw-body": { 783 | "version": "2.4.0", 784 | "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", 785 | "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", 786 | "requires": { 787 | "bytes": "3.1.0", 788 | "http-errors": "1.7.2", 789 | "iconv-lite": "0.4.24", 790 | "unpipe": "1.0.0" 791 | } 792 | }, 793 | "safe-buffer": { 794 | "version": "5.1.2", 795 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", 796 | "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" 797 | }, 798 | "safer-buffer": { 799 | "version": "2.1.2", 800 | "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", 801 | "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" 802 | }, 803 | "send": { 804 | "version": "0.17.1", 805 | "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", 806 | "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", 807 | "requires": { 808 | "debug": "2.6.9", 809 | "depd": "~1.1.2", 810 | "destroy": "~1.0.4", 811 | "encodeurl": "~1.0.2", 812 | "escape-html": "~1.0.3", 813 | "etag": "~1.8.1", 814 | "fresh": "0.5.2", 815 | "http-errors": "~1.7.2", 816 | "mime": "1.6.0", 817 | "ms": "2.1.1", 818 | "on-finished": "~2.3.0", 819 | "range-parser": "~1.2.1", 820 | "statuses": "~1.5.0" 821 | }, 822 | "dependencies": { 823 | "ms": { 824 | "version": "2.1.1", 825 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", 826 | "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" 827 | } 828 | } 829 | }, 830 | "serve-static": { 831 | "version": "1.14.1", 832 | "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", 833 | "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", 834 | "requires": { 835 | "encodeurl": "~1.0.2", 836 | "escape-html": "~1.0.3", 837 | "parseurl": "~1.3.3", 838 | "send": "0.17.1" 839 | } 840 | }, 841 | "setprototypeof": { 842 | "version": "1.1.1", 843 | "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", 844 | "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" 845 | }, 846 | "statuses": { 847 | "version": "1.5.0", 848 | "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", 849 | "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" 850 | }, 851 | "toidentifier": { 852 | "version": "1.0.0", 853 | "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", 854 | "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" 855 | }, 856 | "type-is": { 857 | "version": "1.6.18", 858 | "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", 859 | "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", 860 | "requires": { 861 | "media-typer": "0.3.0", 862 | "mime-types": "~2.1.24" 863 | } 864 | }, 865 | "unpipe": { 866 | "version": "1.0.0", 867 | "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", 868 | "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" 869 | }, 870 | "utils-merge": { 871 | "version": "1.0.1", 872 | "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", 873 | "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" 874 | }, 875 | "vary": { 876 | "version": "1.1.2", 877 | "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 878 | "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" 879 | }, 880 | "ws": { 881 | "version": "7.1.2", 882 | "resolved": "https://registry.npmjs.org/ws/-/ws-7.1.2.tgz", 883 | "integrity": "sha512-gftXq3XI81cJCgkUiAVixA0raD9IVmXqsylCrjRygw4+UOOGzPoxnQ6r/CnVL9i+mDncJo94tSkyrtuuQVBmrg==", 884 | "requires": { 885 | "async-limiter": "^1.0.0" 886 | } 887 | } 888 | } 889 | } 890 | -------------------------------------------------------------------------------- /NodeServer/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nodeserver", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index.js", 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "engines": { 11 | "node": "12.x" 12 | }, 13 | "author": "", 14 | "license": "ISC", 15 | "dependencies": { 16 | "express": "^4.17.1", 17 | "ws": "^7.1.2" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Native WebSocket 2 | 3 | This is the simplest and easiest WebSocket library for Unity you can find! 4 | 5 | - No external DLL's required (uses built-in `System.Net.WebSockets`) 6 | - WebGL/HTML5 support 7 | - Supports all major build targets 8 | - Very simple API 9 | - (Used in [Colyseus Unity SDK](https://github.com/colyseus/colyseus-unity-sdk)) 10 | 11 | ### Consider supporting my work on [Patreon](https://patreon.com/endel) | [Ko-fi](https://ko-fi.com/endeld) | [PayPal](https://www.paypal.me/endeld) 12 | 13 | [![Support me on Patreon](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Fshieldsio-patreon.vercel.app%2Fapi%3Fusername%3Dendel%26type%3Dpatrons&style=for-the-badge)](https://patreon.com/endel) 14 | 15 | ## Installation 16 | 17 | *Requires Unity 2019.1+ with .NET 4.x+ Runtime* 18 | 19 | ### Install via UPM (Unity Package Manager) 20 | 1. Open Unity 21 | 2. Open Package Manager Window 22 | 3. Click Add Package From Git URL 23 | 4. Enter URL: ```https://github.com/endel/NativeWebSocket.git#upm``` 24 | 25 | ### Install manually 26 | 1. [Download this project](https://github.com/endel/NativeWebSocket/archive/master.zip) 27 | 2. Copy the sources from `NativeWebSocket/Assets/WebSocket` into your `Assets` directory. 28 | 29 | ## Usage 30 | 31 | ```csharp 32 | using System; 33 | using System.Collections; 34 | using System.Collections.Generic; 35 | using UnityEngine; 36 | 37 | using NativeWebSocket; 38 | 39 | public class Connection : MonoBehaviour 40 | { 41 | WebSocket websocket; 42 | 43 | // Start is called before the first frame update 44 | async void Start() 45 | { 46 | websocket = new WebSocket("ws://localhost:3000"); 47 | 48 | websocket.OnOpen += () => 49 | { 50 | Debug.Log("Connection open!"); 51 | }; 52 | 53 | websocket.OnError += (e) => 54 | { 55 | Debug.Log("Error! " + e); 56 | }; 57 | 58 | websocket.OnClose += (e) => 59 | { 60 | Debug.Log("Connection closed!"); 61 | }; 62 | 63 | websocket.OnMessage += (bytes) => 64 | { 65 | Debug.Log("OnMessage!"); 66 | Debug.Log(bytes); 67 | 68 | // getting the message as a string 69 | // var message = System.Text.Encoding.UTF8.GetString(bytes); 70 | // Debug.Log("OnMessage! " + message); 71 | }; 72 | 73 | // Keep sending messages at every 0.3s 74 | InvokeRepeating("SendWebSocketMessage", 0.0f, 0.3f); 75 | 76 | // waiting for messages 77 | await websocket.Connect(); 78 | } 79 | 80 | void Update() 81 | { 82 | #if !UNITY_WEBGL || UNITY_EDITOR 83 | websocket.DispatchMessageQueue(); 84 | #endif 85 | } 86 | 87 | async void SendWebSocketMessage() 88 | { 89 | if (websocket.State == WebSocketState.Open) 90 | { 91 | // Sending bytes 92 | await websocket.Send(new byte[] { 10, 20, 30 }); 93 | 94 | // Sending plain text 95 | await websocket.SendText("plain text message"); 96 | } 97 | } 98 | 99 | private async void OnApplicationQuit() 100 | { 101 | await websocket.Close(); 102 | } 103 | 104 | } 105 | ``` 106 | 107 | # Demonstration 108 | 109 | **1.** Start the local WebSocket server: 110 | 111 | ``` 112 | cd Server 113 | npm install 114 | npm start 115 | ``` 116 | 117 | **2.** Open the `NativeWebSocket/Assets/WebSocketExample/WebSocketExampleScene.unity` on Unity and Run. 118 | 119 | 120 | ## Acknowledgements 121 | 122 | Big thanks to [Jiri Hybek](https://github.com/jirihybek/unity-websocket-webgl). 123 | This implementation is based on his work. 124 | 125 | ## License 126 | 127 | Apache 2.0 128 | --------------------------------------------------------------------------------