---
url: >-
  https://lit-ui-router.dev/reference/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/740888c2b2ba358c4dfa52a122e927df6a604b12/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:85](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/ui-router-server/src/resolve-payload.ts#L85)

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:80](https://github.com/simshanith/lit-ui-router/blob/740888c2b2ba358c4dfa52a122e927df6a604b12/packages/ui-router-server/src/resolve-payload.ts#L80)

Encodes `value` as plain JSON data when it is a value this transporter
carries. For any other value it answers with `false`, `null` or
`undefined`, and the next transporter is asked, so an encoding of `false`
or `null` must be wrapped, as in `[false]`; `0` and `""` are encodings.
When it throws, `dehydrate` lists that resolve in `unserializable`.

#### Parameters

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

#### Returns

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