---
url: https://lit-ui-router.dev/api/ui-router-server/ssr/interfaces/Transporter.md
---
[ui-router-server](../../index.md) / [ssr](../index.md) / Transporter

# Interface: Transporter\<T>

Defined in: [resolve-payload.ts:71](https://github.com/simshanith/lit-ui-router/blob/4f9e1ea23844bc57088f9af022eec027c059192b/packages/ui-router-server/src/resolve-payload.ts#L71)

Carries one type of value that plain JSON data can't, such as a `Date`,
through the payload. `dehydrate` from `ui-router-server/ssr` and `seed`
from `ui-router-server/ssr/client` take a record of them, keyed by a name
both sides share.

## Type Parameters

| Type Parameter | Default type | Description |
| ------ | ------ | ------ |
|  `T` | `unknown` | the type of value it carries |

## Methods

### decode()

```ts
decode(encoded): T;
```

Defined in: [resolve-payload.ts:84](https://github.com/simshanith/lit-ui-router/blob/4f9e1ea23844bc57088f9af022eec027c059192b/packages/ui-router-server/src/resolve-payload.ts#L84)

Rebuilds the value from what `encode` returned, after a JSON round trip.
When it throws, `seed` adopts nothing for that resolve.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `encoded` | [`JsonValue`](../type-aliases/JsonValue.md) |

#### Returns

`T`

***

### encode()

```ts
encode(value): JsonValue | undefined;
```

Defined in: [resolve-payload.ts:79](https://github.com/simshanith/lit-ui-router/blob/4f9e1ea23844bc57088f9af022eec027c059192b/packages/ui-router-server/src/resolve-payload.ts#L79)

Encodes `value` as plain JSON data when it is a value this transporter
carries. For any other value it answers with a falsy value, and the next
transporter is asked, so an encoding is never falsy itself. When it
throws, `dehydrate` lists that resolve in `unserializable`.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `value` | `unknown` |

#### Returns

[`JsonValue`](../type-aliases/JsonValue.md) | `undefined`
