unity-websocket-webgl icon indicating copy to clipboard operation
unity-websocket-webgl copied to clipboard

Cant receive any response from server in Build version

Open theonardo23 opened this issue 3 years ago • 5 comments

Everything is working great on the Build version except the OnMessage trigger.

It shows the log when connection is established, and my server can read the message sent from it. Only when I responded from my server side by sending or by broadcasting message, it triggered OnMessage the client that was running on my Unity Game Player but it never triggered the OnMessage on my build.

I'm using the build and run option on unity, so the build is running on localhost & as for the backend it's running on a remote server

theonardo23 avatar Jun 24 '21 18:06 theonardo23

The same for me. OnMessage was never triggered.

vietanhdev avatar Oct 03 '21 04:10 vietanhdev

Same problem here, the websocket connection establishes successfully, and Chrome dev tools show incoming websocket messages, but OnMessage is never triggered (tested in Chrome, Firefox). This Problem only arises on a WebGL Build, UnityEditor and Windows Build working fine.

chucnorrisful avatar Feb 22 '22 13:02 chucnorrisful

#14 ?

Juna-Idler avatar Apr 27 '22 15:04 Juna-Idler

Try fixing it by replacing Module['dynCall_viii']( webSocketState.onMessage, [instanceId, buffer, dataBuffer.length]); to Module['dynCall_viii']( webSocketState.onMessage, instanceId, buffer, dataBuffer.length); in WebSocket.jslib in ~168 and 182 lines

arthur100500 avatar Apr 24 '23 15:04 arthur100500

Try fixing it by replacing Module['dynCall_viii']( webSocketState.onMessage, [instanceId, buffer, dataBuffer.length]); to Module['dynCall_viii']( webSocketState.onMessage, instanceId, buffer, dataBuffer.length); in WebSocket.jslib in ~168 and 182 lines

this worked for me.

BurakSeslikaya avatar Sep 28 '23 15:09 BurakSeslikaya