Skip to content

ContentCodec

Defined in: sdks/browser/dist/typescript-wasm/runtime/public/codec.d.ts:12

A content codec over public values. The send helpers run its steps before the send starts: encode, then fallback when the envelope has none, then shouldPush when the send has no explicit shouldPush option. A step that throws, rejects, or returns a value of the wrong type fails the send with XmtpError.CodecEncodeFailed, and the SDK makes no publish attempt. Each step is a function property, so the value type is checked in both directions.

T

readonly decode: (encoded) => T

Defined in: sdks/browser/dist/typescript-wasm/runtime/public/codec.d.ts:15

EncodedContent

T


readonly encode: (value) => EncodedContent

Defined in: sdks/browser/dist/typescript-wasm/runtime/public/codec.d.ts:14

T

EncodedContent


readonly optional fallback?: (value) => string | undefined

Defined in: sdks/browser/dist/typescript-wasm/runtime/public/codec.d.ts:17

Text for recipients without this codec. Absent: no fallback.

T

string | undefined


readonly optional shouldPush?: (value) => boolean

Defined in: sdks/browser/dist/typescript-wasm/runtime/public/codec.d.ts:19

Whether sending this value notifies recipients. Absent: it does.

T

boolean


readonly type: ContentTypeId

Defined in: sdks/browser/dist/typescript-wasm/runtime/public/codec.d.ts:13