multiplayer-community-contributions icon indicating copy to clipboard operation
multiplayer-community-contributions copied to clipboard

WebSocketTransport Support?

Open brian-kryptomon opened this issue 2 years ago • 5 comments

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 avatar Jul 20 '22 00:07 brian-kryptomon

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

brian-kryptomon avatar Jul 20 '22 09:07 brian-kryptomon

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?

LukeStampfli avatar Jul 20 '22 12:07 LukeStampfli

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 avatar Jul 20 '22 13:07 brian-kryptomon

@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?

brian-kryptomon avatar Jul 23 '22 10:07 brian-kryptomon

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

nicholas-maltbie avatar Nov 24 '22 09:11 nicholas-maltbie