jirihybek / unity-websocket-webgl

Hybrid WebSocket implementation for Unity 3D with support of native and browser client.
Other
248 stars 61 forks source link

Cant receive any response from server in Build version #13

Open theonardo23 opened 3 years ago

theonardo23 commented 3 years ago

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

vietanhdev commented 3 years ago

The same for me. OnMessage was never triggered.

chucnorrisful commented 2 years ago

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.

Juna-Idler commented 2 years ago

14 ?

arthur100500 commented 1 year ago

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

BurakSeslikaya commented 1 year ago

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.