alvyxaz / barebones-masterserver

Master Server framework for Unity
476 stars 106 forks source link

WebGL problem - ReferenceError: webSocketInstances is not defined #209

Open mucco opened 6 years ago

mucco commented 6 years ago

Hello, newbie to this framework, just downloaded it today.

I've tried setting this up on the online game I'm currently developing. I've set up the server and client correctly, I think, because when I run them locally they can talk to each other no problem. They work if I run them within the editor, and they also work if I build the server and client separately, then launch the two Windows executables.

However, when I build and launch the WebGL build of the client, things don't work anymore as I get that error. I'm not really sure what I'm doing wrong here, or if this a framework bug.

Server is set up with a single object holding a MasterServerBehaviour. Client connects to it with the following line:

Msf.Client.Connection.Connect(_addr, _port);

No Msf object is actually created by the Client. I'm not even sure it's the right approach, but from what I could understand the Msf class handles that for me so it shouldn't (?) be necessary. The game actually works with executables, so I don't think it's the problem.

Stacktrace:

SocketCreate blob:null/57d89790-6718-40b1-8b18-b23989d59f3d:84:6 _SocketCreate blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:2646:10 _WebSocket_SocketCreate_m3609328101 blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1545602:7 _U3CConnectU3EcIterator0_MoveNext_m1661120380 blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:974431:27 mftCall_iii blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1588253:65 ZN21InterfaceFuncInvoker0IbE6InvokeEjP11Il2CppClassP12Il2CppObject blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:974805:9 _SetupCoroutine_InvokeMoveNext_m3199342729 blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1232087:21 mftCall_viiii blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1536569:3 Z54RuntimeInvoker_Void_t1185182177_RuntimeObject_IntPtrtPFvvEPK10MethodInfoPvPS4 blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1558950:2 asm.Z54RuntimeInvoker_Void_t1185182177_RuntimeObject_IntPtrtPFvvEPK10MethodInfoPvPS4 blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1999762:10 ftCall_iiiii blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:4874:10 invoke_iiiii blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:4861:11 ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1217490:8 _il2cpp_runtime_invoke blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1526867:9 asm._il2cpp_runtime_invoke blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1971424:10 _il2cpp_runtime_invoke blob:null/57d89790-6718-40b1-8b18-b23989d59f3d:11898:9 Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:2675679:8 ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:2006481:7 ZN9Coroutine14InvokeMoveNextEP21ScriptingExceptionPtr blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:2267700:2 ZN9Coroutine3RunEPb blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:2360159:7 ZN13MonoBehaviour24TryCreateAndRunCoroutineE18ScriptingObjectPtr18ScriptingMethodPtrPP9Coroutine blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:1330623:3 ZN13MonoBehaviour22StartCoroutineManaged2E18ScriptingObjectPtr blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:2140579:3 __Z49MonoBehaviour_CUSTOM_StartCoroutine_AutoInternalP12Il2CppObjectS0 blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:1944492:9 UnityLoader["87d2996672a8b2209c42281223f2d7b4"]/asm.Z49MonoBehaviour_CUSTOM_StartCoroutine_AutoInternalP12Il2CppObjectS0 blob:null/57d89790-6718-40b1-8b18-b23989d59f3d:158515:9 ftCall_iii blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:5775:10 mftCall_iii blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1588254:9 _MonoBehaviour_StartCoroutine_Auto_Internal_m2421197418 blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1531768:9 _MonoBehaviour_StartCoroutine_m3411253000 blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1644281:9 _ClientSocketWs_Connect_m4259240476 blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:754656:2 _ClientSocketWs_Connect_m3790879019 blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1639193:2 mftCall_iiiii blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1534174:64 ZN21InterfaceFuncInvoker2IP12Il2CppObjectP8String_tiE6InvokeEjP11Il2CppClassS1_S3_i blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:947706:9 _OnlineGameClient_Init_m1071683404 blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:634803:3 _OnlineGameClient_Start_m1309906042 blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1694236:2 mftCall_vii blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1595665:3 Z31RuntimeInvoker_Voidt1185182177PFvvEPK10MethodInfoPvPS4 blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1639311:2 asm.Z31RuntimeInvoker_Voidt1185182177PFvvEPK10MethodInfoPvPS4 blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1890526:10 ftCall_iiiii blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:4874:10 invoke_iiiii blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:4861:11 ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1217490:8 _il2cpp_runtime_invoke blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1526867:9 asm._il2cpp_runtime_invoke blob:null/57d89790-6718-40b1-8b18-b23989d59f3d%20line%20795%20>%20eval:1971424:10 _il2cpp_runtime_invoke blob:null/57d89790-6718-40b1-8b18-b23989d59f3d:11898:9 Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:2675679:8 ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:2006481:7 ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtrP21ScriptingExceptionPtr blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:634906:9 ZN13MonoBehaviour30InvokeMethodOrCoroutineCheckedE18ScriptingMethodPtr18ScriptingObjectPtr blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:1971075:7 ZN13MonoBehaviour16DelayedStartCallEP6ObjectPv blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:2369114:2 mftCall_iii blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:2833107:64 ZN18DelayedCallManager6UpdateEi blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:1073785:33 mftCall_vii blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:2835573:3 __ZZ23InitPlayerLoopCallbacksvEN52FixedUpdateScriptRunDelayedFixedFrameRateRegistrator7ForwardEv blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:2676678:2 mftCall_v blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:2873413:3 Z10PlayerLoopv blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:797510:15 ZL8MainLoopv blob:null/4f2def79-1ffd-4095-ae77-1a4d1b43ecba:2096665:3 UnityLoader["87d2996672a8b2209c42281223f2d7b4"]/asm.__ZL8MainLoopv blob:null/57d89790-6718-40b1-8b18-b23989d59f3d:212503:9 ftCall_v blob:null/57d89790-6718-40b1-8b18-b23989d59f3d:30926:9 browserIterationFunc blob:null/57d89790-6718-40b1-8b18-b23989d59f3d:11762:4 runIter blob:null/57d89790-6718-40b1-8b18-b23989d59f3d:11160:5 Browser_mainLoop_runner blob:null/57d89790-6718-40b1-8b18-b23989d59f3d:11800:3

I downloaded this library precisely because I need a framework that makes executable AND WebGL builds work seamlessly. Is there a solution to this problem?