MqttX.Transport.ThousandIsland (MqttX v0.13.0)

Copy Markdown View Source

ThousandIsland transport adapter for MqttX.

This adapter uses ThousandIsland as the underlying TCP/TLS server.

Usage

MqttX.Server.start_link(MyHandler, handler_opts,
  transport: MqttX.Transport.ThousandIsland,
  port: 1883
)

Options

  • :port - Port to listen on (default: 1883)
  • :ip - IP address to bind to (default: {0, 0, 0, 0})
  • :transport_module - ThousandIsland transport module (ThousandIsland.Transports.TCP or ...SSL)
  • :transport_options - SSL/TLS options when using the SSL transport, merged over a secure baseline (TLS 1.2/1.3, secure_renegotiate)
  • :num_acceptors - Number of acceptor processes (default: 100)
  • :read_timeout - ThousandIsland socket read timeout (default: :infinity). MQTT liveness is enforced by the protocol keepalive and :max_idle_timeout below; TI's own 60 s default would disconnect spec-compliant clients whose Keep Alive exceeds it.
  • :name - The handle MqttX.Server.deliver/4 finds this listener by (default: the port number)
  • :rate_limit - Options for MqttX.Server.RateLimiter: :max_connections (all peers), :max_connections_per_ip, :max_messages, :interval (default: none)

Everything below is passed through transport_opts to the protocol handler and applies to all adapters:

  • :max_packet_size - Reject packets whose declared size exceeds this, before the body is buffered (default: 1 MiB, :infinity disables)
  • :max_idle_timeout - Close a socket idle for this long regardless of the negotiated Keep Alive, which does not apply when a client connects with keep_alive: 0 (default: 900_000 ms, :infinity disables)
  • :connect_timeout - Close a socket that has not completed CONNECT within this window (default: 10_000 ms, :infinity disables)
  • :max_retained_messages - Cap on distinct retained topics (default: 100_000, :infinity disables)
  • :receive_maximum - Inbound QoS > 0 flow-control window (default: 100; with the packet cap it bounds what a client can make the broker hold before PUBREL). A client that exceeds it is disconnected with 0x93 (§4.9)
  • :max_outbound_queue - Cap on publishes queued per session: QoS > 0 publishes waiting for the client's Receive Maximum window, and what MqttX.Server.deliver/3 holds for a session that is not connected; beyond it they are dropped with a warning (default: 10_000, :infinity disables)
  • :max_session_expiry_interval - Longest a session is kept after its connection ends, in seconds. A v5 client asking for more is told this value in CONNACK (§3.2.2.3.2); a 3.1.1 client with CleanSession 0 is kept exactly this long (default: 86_400, :infinity lifts the cap)
  • :topic_alias_maximum - Topic aliases the server accepts (default: 100)
  • :outbound_topic_aliases - Put Topic Aliases on the PUBLISHes sent to a v5 client that allows them, up to its Topic Alias Maximum (§3.3.2.3.4; default: true)
  • :max_subscriptions - Filters one session may hold (default: 10_000, :infinity lifts it); past it a new filter is refused with 0x97
  • :max_sessions - Sessions this listener keeps, connected or kept for their expiry (default: :infinity); a CONNECT needing a new one past it is refused with 0x97
  • :server_keep_alive - Cap on the Keep Alive, in seconds: a v5 client asking for more, or for none (0), is told this value in CONNACK (§3.2.2.3.14) and must use it; one asking for less keeps its own. A 3.1.1 client cannot be told, so it is not capped
  • :supported_versions - Accepted protocol levels (default: [3, 4, 5])
  • :qos2_retry_interval / :qos2_max_retries - Deprecated and ignored since 0.12.0: the broker never re-sends QoS 1/2 packets on a live connection (MQTT §4.4)