跳转到内容
简体中文

MqttOptionsBuilder

此内容尚不支持你的语言。

Defined in: src/io/broker/MqttOptions.ts:69

Fluent builder for MqttOptionsType.

new MqttOptionsBuilder(): MqttOptionsBuilder

MqttOptionsBuilder

BrokerOptionsBuilder<MqttOptionsType>.constructor

build(): Partial<T>

Defined in: src/util/OptionsBuilder.ts:51

Snapshot the set fields as an independent Partial<T> (own props only).

Partial<T>

BrokerOptionsBuilder.build


withBrokerUrl(url): this

Defined in: src/io/broker/MqttOptions.ts:76

Broker URL — mqtt://, mqtts://, ws://, wss://.

string

this


withCircuitBreaker(failureThreshold, resetMs): this

Defined in: src/io/broker/BrokerOptions.ts:125

Circuit breaker around connect attempts.

number

number

this

BrokerOptionsBuilder.withCircuitBreaker


withCleanSession(clean?): this

Defined in: src/io/broker/MqttOptions.ts:101

Clean-session flag. Default true.

boolean = true

this


withClientId(clientId): this

Defined in: src/io/broker/MqttOptions.ts:81

Stable client id. When omitted the broker assigns one.

string

this


withCodec(codec): this

Defined in: src/io/broker/MqttOptions.ts:116

Payload codec for entity() decode + entity publish encode. Default JSON.

MqttCodec<unknown>

this


withCredentials(username?, password?): this

Defined in: src/io/broker/MqttOptions.ts:86

Username / password credentials.

string

string

this


withKeepAlive(seconds): this

Defined in: src/io/broker/MqttOptions.ts:106

Keep-alive interval in seconds. Default 60.

number

this


withOutboundBuffer(limit): this

Defined in: src/io/broker/BrokerOptions.ts:130

Outbound buffer size (messages held while disconnected). Default 1000; 0 = fail-fast.

number

this

BrokerOptionsBuilder.withOutboundBuffer


withProtocolVersion(version): this

Defined in: src/io/broker/MqttOptions.ts:111

MQTT protocol version — 4 (3.1.1, default) or 5.

4 | 5

this


withQos(qos): this

Defined in: src/io/broker/MqttOptions.ts:91

Default QoS used by publish / subscribe when not overridden per call.

MqttQos

this


withReconnect(policy): this

Defined in: src/io/broker/BrokerOptions.ts:120

Reconnect policy (or false to disable auto-reconnect).

false | { factor?: number; initialDelayMs?: number; maxAttempts?: number; maxDelayMs?: number; } | undefined

false


{ factor?: number; initialDelayMs?: number; maxAttempts?: number; maxDelayMs?: number; }

number

number

number

Cap on retry attempts. Default: Infinity (retry forever).

number


undefined

this

BrokerOptionsBuilder.withReconnect


withWill(will): this

Defined in: src/io/broker/MqttOptions.ts:96

Last-will-and-testament published by the broker on ungraceful disconnect.

string | Uint8Array<ArrayBufferLike>

MqttQos

boolean

string

this


static create(): MqttOptionsBuilder

Defined in: src/io/broker/MqttOptions.ts:71

Start a fresh builder. Equivalent to new MqttOptionsBuilder().

MqttOptionsBuilder