Closed Scormave closed 10 months ago
I think StartClose
doesn't work because it just starts the closing procedure, it doesn't tears down the whole connection immediately.
Could you try out this patched file: https://gist.github.com/Benedicht/2eb7c1e29fd5684de4cbd9340d2bdcb5
You have to overwrite the old one in the Best HTTP\Plugins\WebGL\
folder (BestHTTP_WebSocket.jslib
).
Then you can add the following line somewhere:
#if UNITY_WEBGL && !UNITY_EDITOR
[DllImport("__Internal")]
public static extern void WS_EmergencyRelease();
#endif
And use it in your OnApplicationQuit
event-handler:
#if UNITY_WEBGL && !UNITY_EDITOR
WS_EmergencyRelease();
#endif
I've tried the patched file and WS_EmergencyRelease
call and it seems that everything works fine without any errors. Thank you!
Will this fix be included in the next version of BestHTTP?
Will this fix be included in the next version of BestHTTP?
I'm not sure about it yet.
Will keep the changes in the .jslib, anyone who needs it just have to add the DllImport
code:
#if UNITY_WEBGL && !UNITY_EDITOR
[DllImport("__Internal")]
public static extern void WS_EmergencyRelease();
#endif
Hello!
I'm trying to get SignalR Core working in WebGL build. When WebGL build is loaded, everything is fine and work as intended. But, when I close the Unity app without closing the tab (it is a case for a one-page web app for ex.), I encounter errors like this one:
Even if I call
StartClose
forHubConnection
inOnApplicationQuit
nothing changes, there are still errors. It looks like JavaScript part of WebSocket implementation is trying to call the Unity part, but the Unity instance is already dead. Sometimes after these errors the whole tab freezes and can be killed only from Task Manager. Could you please help me with this issue?