MqttOptionsBuilder
Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.
Defined in: src/io/broker/MqttOptions.ts:69
Fluent builder for MqttOptionsType.
Extends
Section titled “Extends”BrokerOptionsBuilder<MqttOptionsType>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new MqttOptionsBuilder():
MqttOptionsBuilder
Returns
Section titled “Returns”MqttOptionsBuilder
Inherited from
Section titled “Inherited from”BrokerOptionsBuilder<MqttOptionsType>.constructor
Methods
Section titled “Methods”build()
Section titled “build()”build():
Partial<T>
Defined in: src/util/OptionsBuilder.ts:51
Snapshot the set fields as an independent Partial<T> (own props only).
Returns
Section titled “Returns”Partial<T>
Inherited from
Section titled “Inherited from”BrokerOptionsBuilder.build
withBrokerUrl()
Section titled “withBrokerUrl()”withBrokerUrl(
url):this
Defined in: src/io/broker/MqttOptions.ts:76
Broker URL — mqtt://, mqtts://, ws://, wss://.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”this
withCircuitBreaker()
Section titled “withCircuitBreaker()”withCircuitBreaker(
failureThreshold,resetMs):this
Defined in: src/io/broker/BrokerOptions.ts:125
Circuit breaker around connect attempts.
Parameters
Section titled “Parameters”failureThreshold
Section titled “failureThreshold”number
resetMs
Section titled “resetMs”number
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BrokerOptionsBuilder.withCircuitBreaker
withCleanSession()
Section titled “withCleanSession()”withCleanSession(
clean?):this
Defined in: src/io/broker/MqttOptions.ts:101
Clean-session flag. Default true.
Parameters
Section titled “Parameters”clean?
Section titled “clean?”boolean = true
Returns
Section titled “Returns”this
withClientId()
Section titled “withClientId()”withClientId(
clientId):this
Defined in: src/io/broker/MqttOptions.ts:81
Stable client id. When omitted the broker assigns one.
Parameters
Section titled “Parameters”clientId
Section titled “clientId”string
Returns
Section titled “Returns”this
withCodec()
Section titled “withCodec()”withCodec(
codec):this
Defined in: src/io/broker/MqttOptions.ts:116
Payload codec for entity() decode + entity publish encode. Default JSON.
Parameters
Section titled “Parameters”MqttCodec<unknown>
Returns
Section titled “Returns”this
withCredentials()
Section titled “withCredentials()”withCredentials(
username?,password?):this
Defined in: src/io/broker/MqttOptions.ts:86
Username / password credentials.
Parameters
Section titled “Parameters”username?
Section titled “username?”string
password?
Section titled “password?”string
Returns
Section titled “Returns”this
withKeepAlive()
Section titled “withKeepAlive()”withKeepAlive(
seconds):this
Defined in: src/io/broker/MqttOptions.ts:106
Keep-alive interval in seconds. Default 60.
Parameters
Section titled “Parameters”seconds
Section titled “seconds”number
Returns
Section titled “Returns”this
withOutboundBuffer()
Section titled “withOutboundBuffer()”withOutboundBuffer(
limit):this
Defined in: src/io/broker/BrokerOptions.ts:130
Outbound buffer size (messages held while disconnected). Default 1000; 0 = fail-fast.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BrokerOptionsBuilder.withOutboundBuffer
withProtocolVersion()
Section titled “withProtocolVersion()”withProtocolVersion(
version):this
Defined in: src/io/broker/MqttOptions.ts:111
MQTT protocol version — 4 (3.1.1, default) or 5.
Parameters
Section titled “Parameters”version
Section titled “version”4 | 5
Returns
Section titled “Returns”this
withQos()
Section titled “withQos()”withQos(
qos):this
Defined in: src/io/broker/MqttOptions.ts:91
Default QoS used by publish / subscribe when not overridden per call.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”this
withReconnect()
Section titled “withReconnect()”withReconnect(
policy):this
Defined in: src/io/broker/BrokerOptions.ts:120
Reconnect policy (or false to disable auto-reconnect).
Parameters
Section titled “Parameters”policy
Section titled “policy”false | { factor?: number; initialDelayMs?: number; maxAttempts?: number; maxDelayMs?: number; } | undefined
false
Type Literal
Section titled “Type Literal”{ factor?: number; initialDelayMs?: number; maxAttempts?: number; maxDelayMs?: number; }
factor?
Section titled “factor?”number
initialDelayMs?
Section titled “initialDelayMs?”number
maxAttempts?
Section titled “maxAttempts?”number
Cap on retry attempts. Default: Infinity (retry forever).
maxDelayMs?
Section titled “maxDelayMs?”number
undefined
Returns
Section titled “Returns”this
Inherited from
Section titled “Inherited from”BrokerOptionsBuilder.withReconnect
withWill()
Section titled “withWill()”withWill(
will):this
Defined in: src/io/broker/MqttOptions.ts:96
Last-will-and-testament published by the broker on ungraceful disconnect.
Parameters
Section titled “Parameters”payload
Section titled “payload”string | Uint8Array<ArrayBufferLike>
retain?
Section titled “retain?”boolean
string
Returns
Section titled “Returns”this
create()
Section titled “create()”
staticcreate():MqttOptionsBuilder
Defined in: src/io/broker/MqttOptions.ts:71
Start a fresh builder. Equivalent to new MqttOptionsBuilder().
Returns
Section titled “Returns”MqttOptionsBuilder
