Cysharp / Cysharp/GrpcWebSocketBridge

(WebGL) dynCall are deprecated and not working in Unity6 with Wasm23 enabled

Open
#55 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
118
Forks
15
PR merge metrics
No merged PRs in 30d

Description

After transfering game to Unity6 i've discovered that it crashes in WebGL builds with cryptic errors:

10:32:41.453 WebGL_Build.framework.js.br:9 Uncaught ReferenceError: dynCall is not defined
    at connection.socket.onopen (WebGL_Build.framework.js.br:9:150900)
connection.socket.onopen @ WebGL_Build.framework.js.br:9

After some investigation i've found that dynCalls are deprecated and not working when wasm 2023 enabled it seems.

For now i've added jspre file with shim to work around this issue but JsWebSocket.jslib need to be updated to use {{{ makeDynCall('vii', 'callback') }}}(1, 2) as per Unity docs.

My shim based on https://github.com/RageAgainstThePixel/com.utilities.websockets/blob/main/Utilities.Websockets/Packages/com.utilities.websockets/Runtime/Plugins/WebSocket.jspre with global dynCall's added is attached for anyone to use while fix is pending - rename to WebSocket.jspre and put into Plugins/WebGL

WebSocket.txt

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Unity/JsWebSocket.jslib, then review Unity's deprecated dynCall guidance and the attached WebSocket.jspre shim. Update the WebGL callback invocation to use makeDynCall as described, and verify that a Unity 6 WebGL build with Wasm 2023 no longer reports dynCall as undefined.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, unity, wasm
Domain
game-dev, web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.