# WebGL support

**coherence** SDK supports networking in WebGL without any additional setup. Both Rooms and World topologies are supported, as are all of coherence features (persistency, authority switch, etc.) as well as our sample connection UIs.

Basically, it just works! It's perfect for game jams and quick prototypes.

{% hint style="warning" %}
WebGL has no multi-threading support. While `async`/`await` can be used, inherently threaded functionality (like [Task.Delay](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task.delay)) will not run properly.
{% endhint %}

You can also use the **Online Dashboard** to configure a page where you can easily share your WebGL build with the world:

<figure><img src="/files/W8ug3ENEO42UfLp6TqW0" alt=""><figcaption><p>A coherence WebGL game hosted on the coherence Cloud</p></figcaption></figure>

## More details

WebGL builds use WebRTC to connect to the Replication Server and so the ports used to connect are different from the usual UDP ports. This is managed automatically in the sample connect dialogs, but if you are building your own, you need to make sure you're connecting to the the correct port which is specified by the `--signalling-port` when starting the Replication Server locally (defaults to 42002 for Rooms and 32002 for Worlds).

This is resolved automatically when using the [Unity Cloud Service API](/hosting/coherence-cloud/coherence-cloud-apis.md) to create and join Rooms and Worlds.

### Linux builds

For anyone building WebGL in Linux, some additional packages are required.

**Ubuntu:**\
`sudo apt install clang libtinfo5 python python-setuptools`

**Other distros:**

Check with your package repository to install the correct packages for your distribution.

### Running locally

For running a WebGL build locally, please refer to the [official Unity documentation](https://docs.unity3d.com/Manual/webgl-building.html).

{% hint style="warning" %}
WebGL builds running locally can't connect to the coherence Cloud on Firefox.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.coherence.io/support/webgl.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
