[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [WebSocket](https://evolu.dev/docs/api-reference/common/WebSocket) › WebSocketUrl

```ts
const WebSocketUrl: brand(
  "WebSocketUrl",
  Url,
  (value: string) =>
    isWebSocketUrl(value)
      ? ok()
      : err<WebSocketUrlError>({ type: "WebSocketUrl", value }),
  formatWebSocketUrlError,
);
```

Defined in: [packages/common/src/WebSocket.ts:661](https://github.com/evoluhq/evolu/blob/aa223771feea747ffb1b0f5f3271574455633e37/packages/common/src/WebSocket.ts#L661)

[Url](https://evolu.dev/docs/api-reference/common/Type/variables/Url) that a [WebSocket](https://evolu.dev/docs/api-reference/common/WebSocket/interfaces/WebSocket) connects to, such as
`wss://free.evoluhq.com/`.

Its scheme is `ws:` or `wss:`. It can have a query, such as the `ownerId`
that `createOwnerWebSocketTransport` adds. It has no fragment, which the
WebSocket constructor rejects, and no username or password, which browsers
and Node.js send only after the server asks for them, and React Native on
Android never.

Each label of its host has 1 to 63 characters and the host at most 253, as
DNS allows. Its host, path, and query have only the characters java.net.URI
allows there, with every `%` followed by two hex digits, and its port is not 0. React Native on Android checks the URL with java.net.URI and OkHttp, which
throw natively for a longer label, another character, or port 0.

Like Url, WebSocketUrl does not normalize; use [WebSocketUrlFromString](https://evolu.dev/docs/api-reference/common/WebSocket/variables/WebSocketUrlFromString)
to convert other spellings, such as user input.

### Example

```ts
import { assertErr, assertOk, WebSocketUrl } from "@evolu/common";

assertOk(
  WebSocketUrl.fromUnknown("wss://free.evoluhq.com/"),
  "wss://free.evoluhq.com/",
);

assertErr(WebSocketUrl.fromUnknown("wss://free.evoluhq.com/#sync"), {
  type: "WebSocketUrl",
  value: "wss://free.evoluhq.com/#sync",
});
```