endel / NativeWebSocket

🔌 WebSocket client for Unity - with no external dependencies (WebGL, Native, Android, iOS, UWP)
Other
1.13k stars 155 forks source link

Alternative that doesn't require async/await or `#if` on web #86

Open mikerochip opened 1 year ago

mikerochip commented 1 year ago

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!