Unity-Technologies / multiplayer-community-contributions

Community contributions to Unity Multiplayer Networking products and services.
MIT License
421 stars 161 forks source link

WebSocketTransport Support? #175

Open brian-kryptomon opened 2 years ago

brian-kryptomon commented 2 years ago

I have been trying to get the WebSocketTransport to work and have found a few issues so I wasn't sure if this was still being supported.

There are issues with the JSWebSocketClient.jslib as it throws Runtime not found errors - from what I have read the newer versions of unity no longer support Runtime.dyncall and you have to do something like Module['dyncall_v#']. I tried to make these changes and I no longer receive the errors but now I am getting Netcode warnings:

[Netcode] Received a packet too small to contain a BatchHeader. Ignoring it.

My server is getting the messages correctly now but messages going down to the client seem to give the above warning and the message isn't processed.

Anyone come across this or know who wrote this package originally?

brian-kryptomon commented 2 years ago

@LukeStampfli You seem to be one of the most active people here - any ideas?

LukeStampfli commented 2 years ago

I haven't worked on the WebSocketTransport and I don't work at Unity anymore so I'm not sure what's wrong here. Maybe the websocket transport for some reason passes empty messages of size 0 up to the Netcode layer if it polls and there is no incoming message?

brian-kryptomon commented 2 years ago

I haven't worked on the WebSocketTransport and I don't work at Unity anymore so I'm not sure what's wrong here. Maybe the websocket transport for some reason passes empty messages of size 0 up to the Netcode layer if it polls and there is no incoming message?

Thanks for replying - I was using a NetworkDelivery method that fragmented the messages which seems to not be supported in WebSocketTransport. I swapped to Reliable and I was able to get it working now and now just have one call that is too large and not sending. I had swapped delivery method because I had a large payload being sent at the start of the game.

Do you know if I post my fix if it can be incorporated into the WebSocketTransport?

brian-kryptomon commented 2 years ago

@LukeStampfli I was able to fix some bugs related to this transport and the new jslib required for newer versions of Unity. I'm assuming I'm allowed to create a branch and request a merge to fix the issues?

nicholas-maltbie commented 1 year ago

Opened PR #188 to attempt to address this issue :)