I wasn't super keen on being required to use async/await nor having to put #if !UNITY_WEBGL || UNITY_EDITOR in calling code, so I made an alternative repo that lets calling code use whatever the caller wants.
You can poll or use events. Use coroutines, async/await, Update() method. Whatever you want. You can disconnect and reconnect, and since some servers care, text will be sent as text type and byte[] as binary type.
Hi there! Thank you @endel for this repo.
I wasn't super keen on being required to use
async/await
nor having to put#if !UNITY_WEBGL || UNITY_EDITOR
in calling code, so I made an alternative repo that lets calling code use whatever the caller wants.It is available here: https://github.com/mikerochip/unity-websocket
You can poll or use events. Use coroutines, async/await, Update() method. Whatever you want. You can disconnect and reconnect, and since some servers care, text will be sent as text type and
byte[]
as binary type.This issue was actually inspired by your own!