Ir al contenido
Español

mqttJsonCodec

Esta página aún no está disponible en tu idioma.

mqttJsonCodec<T>(options?): MqttCodec<T>

Defined in: src/io/broker/MqttCodec.ts:75

Default codec: entities ↔ UTF-8 JSON. encode runs JSON.stringify then UTF-8 encodes; decode UTF-8 decodes then JSON.parses.

Pass validate to run a schema check (e.g. a zod parser) on the parsed value — it receives the unknown parse result and must return (or throw for) a T. A thrown validator is wrapped as a MqttDecodeError.

T = unknown

(value) => T

MqttCodec<T>