How to handle server sent event in unity without using a thread

Hello.
In my current unity app, I am using a Thread to receive message via Server Sent Event and send the message to the main thread via Synchronization.Context.

But as I know, WebGL does not support “Thread”.

Is there work around to achieve my purpose I mentioned above?

Thank you in advance.

What is “Server Sent Event”? WebGL can only do HTTP connections, nothing else. You can use WebSockets to connect to a WebSocket server. The WebSocket protocol is based on HTTP so it’s actually allowed by the browser. Though you can not do arbitrary socket connections.

Unity does not directly provide any API for WebSocket connections. So you would need to do that in Javascript or find a library that does it for you. You can not use threads in WebGL builds. So you would usually do things in coroutines or work with callbacks. Most things in browser-based Javascript is event / callback driven anyways.