Skip to content
Back to skills

Mqtt Knowledge Patch

ASecurity

MQTT

  • 25 stars
  • 0 votes
  • 0 copies
  • 6 views
  • Added September 5, 2026
developmentgodebugging

Works with

  • cli

Security analysis

A100/100

Pro scans all 8 files and shows the line behind each finding

Scanned December 1, 2026

npx -y skills add Nevaberry/nevaberry-plugins --skill mqtt-knowledge-patch --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Mqtt Knowledge Patch?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Mqtt Knowledge Patch
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/nevaberry-mqtt-knowledge-patch/badge)](https://www.skillsdirectory.com/skills/nevaberry-mqtt-knowledge-patch)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: mqtt-knowledge-patch
description: MQTT
version: "MQTT-SN 2.0 CSD01"
license: MIT
metadata:
  author: Nevaberry
---


# MQTT Compatibility Guidance

> [!CAUTION]
> The current prerelease version is **MQTT-SN 2.0 CSD01**.
> Prerelease guidance may change before stable release.

Load this skill when implementing, reviewing, or debugging MQTT or MQTT-SN
packet encoding, sessions, delivery, subscriptions, authentication, or transports.
Use the quick reference below for common compatibility decisions and open the
relevant topic reference for complete packet fields, examples, and exceptions.

## Reference index

| Reference | Topics |
| --- | --- |
| [MQTT-SN migration and wire format](references/mqtt-sn-migration-and-wire.md) | Native packet changes, optional compatibility, framing, flags, topic fields, Unicode, Reason Codes, encapsulation, discovery |
| [MQTT-SN sessions and delivery](references/mqtt-sn-sessions-and-delivery.md) | Virtual Connections, Wills, alias lifetime, request limits, retries, sessionless publication, sleep and wake cycles, errors |
| [MQTT-SN authentication and protection](references/mqtt-sn-authentication-and-protection.md) | Authentication exchanges, credential methods, authorization, DTLS, duplicate suppression, protection encoding and schemes |
| [MQTT 5 framing and properties](references/mqtt5-framing-and-properties.md) | Minimal encodings, fixed-header validation, compact acknowledgements, property placement, Reason Code scopes |
| [MQTT 5 operations and transports](references/mqtt5-operations-and-transports.md) | Connection establishment, Session State, Will lifecycle, authentication, redirection, errors, SOCKSv5, WebSocket, conformance |
| [MQTT 5 publish and subscriptions](references/mqtt5-publish-and-subscriptions.md) | Expiry, forwarding, QoS progress, send quota, subscription options and identifiers, shared delivery, request and response metadata |

## Migration and packet compatibility

### MQTT-SN native packet changes

> **Prerelease (`2.0-csd01`):** This guidance may change before stable release.

Carry the Will in `CONNECT` and drop the MQTT-SN 1.2 Will-message exchange.
Request sleep with `SLEEPREQ` and handle `SLEEPRESP`; `DISCONNECT` is a one-way
notification. Native publish packets use a full Topic Name or a two-byte Topic
Alias, with Session and Predefined aliases supported. The native format removes
the Short Topic Name. Packet Type assignments also change from MQTT-SN 1.2;
use the registry in the migration and wire reference.

### MQTT-SN Length and Packet Identifier handling

> **Prerelease (`2.0-csd01`):** This guidance may change before stable release.

Clients and Servers MUST accept both Length forms. An initial `0x01` introduces
a two-byte big-endian total length; any other first byte is the total length.
Length includes the Length field itself. Use the underlying network's packet
limit when sending because MQTT-SN has no fragmentation or reassembly.
`PUBLISH` carries a Packet Identifier at QoS 1 or 2 and MUST omit it at QoS 0.

### MQTT-SN negotiated connection values

> **Prerelease (`mqtt-sn-2.0-csd01`):** This guidance may change before stable release.

Set Protocol Version to `0x02`. CONNECT bit 6 lets the Server replace Keep Alive
and Session Expiry in CONNACK and Sleep Duration in SLEEPRESP. With bit 6 clear,
the Server MUST omit those fields. Both peers use supplied replacements;
omitted replacements fall back to the Client's values.
Use a positive two-byte Keep Alive in seconds; zero is a Protocol Error.

### MQTT 5 framing and compact acknowledgements

Variable Byte Integers MUST use the fewest bytes for Remaining Length,
Property Length, Property Identifiers, and Subscription Identifier values.
Wrong reserved fixed-header flags are a Malformed Packet (`0x81`).
For PUBACK, PUBREC, PUBREL, and PUBCOMP, Remaining Length `2` means implicit
success; `3` permits an explicit Reason Code with an omitted zero Property Length.
DISCONNECT uses lengths `0` and `1` for the corresponding compact forms.

## Sessions, delivery, and sleep

### MQTT-SN request limits and retries

> **Prerelease (`mqtt-sn-2.0-csd01-guidance`):** This guidance may change before stable release.

Each endpoint MUST wait for acknowledgement before starting another listed
request: QoS 1 or 2 `PUBLISH`, `PUBREC`, `PUBREL`, `REGISTER`, `SUBSCRIBE`,
`UNSUBSCRIBE`, `PINGREQ`, `SLEEPREQ`, or `AUTH`. A different Packet Identifier
on a listed request while one from that peer is outstanding requires
`DISCONNECT` `0x93` and deletion of the Virtual Connection.
`CONNECT` and `AUTH` MUST NOT be retried. Consult the sessions reference for
the permitted retry packets, timers, protection requirements, and replay rules.

### MQTT-SN sessionless publication

> **Prerelease (`2.0-csd01`):** This guidance may change before stable release.

> **Prerelease (`mqtt-sn-2.0-csd01-guidance`):** This guidance may change before stable release.

Use `PUBWOS` (`0x12`) without a Session at the receiver and omit the Packet
Identifier. A receiver MAY accept ownership and MUST treat an accepted message
as QoS 0. It sends no response, and the sender performs no retry.
An accepted message with `RETAIN=1` replaces the retained message for its topic;
an empty payload still receives normal processing and MUST clear that message.

### MQTT-SN sleep and wake completion

> **Prerelease (`mqtt-sn-2.0-csd01`):** This guidance may change before stable release.

SLEEPREQ bit 0 preserves Session Topic Aliases when set; clear it to release
them and renegotiate when Awake or Active. A granted request suspends Keep Alive
and starts the Sleep Duration timer while keeping the Virtual Connection.
A sleeping Client wakes with `PINGREQ`. `PINGRESP` ends the Awake period and can
append a queue count: `0` means empty, `1`–`254` is exact, and `0xFF` is an
unspecified positive count. See the sessions reference for permitted state traffic.

### MQTT 5 Session State and Will takeover

A Client with no local Session State receiving Session Present `1` MUST close
the Network Connection and can reconnect with Clean Start `1`. With Session
Present `0`, it MUST discard old local Session State if it continues.
Resuming the same Session before Will Delay expires suppresses the old Will.
The Will is published when the old connection closes with delay zero or when
the old Session ends, including takeover with Clean Start `1` or old expiry zero.

### MQTT 5 QoS completion and retransmission

Both peers MUST resend unacknowledged QoS 1 and 2 `PUBLISH` and outstanding
`PUBREL` with original Packet Identifiers only on reconnect with Clean Start `0`
and a present Session. A `PUBACK` or `PUBREC` Reason Code of `0x80` or greater
completes that `PUBLISH` for retry purposes. Sending `PUBREL` also ends `PUBLISH`
retransmission for that QoS 2 exchange. Once QoS 2 PUBLISH is sent, its sender
MUST NOT apply Message Expiry to the in-flight exchange; a receiver applying
expiry MUST still complete the QoS 2 acknowledgement sequence.

### MQTT 5 send quota

Initialize send quota on each Network Connection to a nonzero value at or below
the peer's Receive Maximum. Keep processing and responding to other control
packets at zero quota. Zero blocks outgoing QoS 1 and 2 `PUBLISH`; either peer
MAY continue or pause QoS 0. Every PUBACK and PUBCOMP restores one slot, as does
each PUBREC with Reason Code `0x80` or greater, capped at the initial quota.

## Subscriptions and request metadata

### MQTT 5 subscription capabilities and replay

A Server advertising Maximum QoS `0` or `1` MUST still accept Requested QoS
`0`, `1`, and `2` in SUBSCRIBE. Setting No Local on a Shared Subscription is a
Protocol Error; nonzero reserved Subscription Options bits 6 or 7 are malformed.
Retained messages replayed on subscription always carry `RETAIN=1`, including
with Retain As Published `0`. Retain Handling controls only subscription-time
replay. A Server can deliver matching PUBLISH before SUBACK.

### MQTT 5 Subscription Identifiers and shared recovery

Client-to-Server `PUBLISH` MUST omit Subscription Identifiers. For one PUBLISH
covering overlapping matches, the Server MUST include every matching
subscription's identifier when present, including repeated values.
Shared QoS 1 delivery MAY be reassigned after a broken connection and SHOULD
be reassigned if that Session expires. Shared QoS 2 delivery MUST complete when
the chosen Client reconnects and MUST NOT be reassigned if that Session ends.
At either QoS, a failure PUBACK or PUBREC (`0x80` or greater) requires discarding
the message without reassignment.

### MQTT 5 response metadata

The Server MUST forward `Response Topic` and `Correlation Data` unchanged.
For the informative request and response pattern, publish the reply to the
request's `Response Topic`, copy any `Correlation Data`, and omit `Response Topic`
on the reply itself. A Will can carry both properties in its Will Properties block.

## Authentication and transports

### MQTT-SN authentication flow

> **Prerelease (`mqtt-sn-2.0-csd01`):** This guidance may change before stable release.

Wait for CONNACK `0x00` before sending traffic that needs a Virtual Connection.
During establishment the Server MUST process only AUTH packets from the Client
after CONNECT.
A Server's AUTH or CONNACK echoes the Packet Identifier of the specific CONNECT
or Client AUTH it answers. The authentication reference gives the block encoding.

### MQTT-SN re-authentication

> **Prerelease (`mqtt-sn-2.0-csd01-guidance`):** This guidance may change before stable release.

After successful CONNACK, a Client that supplied an Authentication Method can
start with `AUTH` `0x19` and MUST reuse that method. Pause other packet flow.
Exchange `AUTH` `0x18` while more data is needed; finish on Server `AUTH` `0x00`.
On failure the endpoint MUST send DISCONNECT with an appropriate Reason Code
and delete the Virtual Connection.

### MQTT-SN protection scope

> **Prerelease (`mqtt-sn-2.0-csd01`):** This guidance may change before stable release.

An endpoint supporting Protection Encapsulation with the peer's shared key MUST
protect every MQTT-SN packet exchanged with that peer. The originator applies
protection. A Forwarder can wrap a protected packet; Forwarder Encapsulation is
prohibited as Protection Encapsulation's payload.

### MQTT 5 authentication and pipelining

Without enhanced authentication, a Client can send control packets immediately
after CONNECT. With Authentication Method in CONNECT, it MUST restrict sends
to AUTH or DISCONNECT until CONNACK. Both peers MUST repeat that method in every
AUTH and any successful CONNACK. If CONNECT omits the method, both peers MUST
omit AUTH, and the Server MUST omit Authentication Method from CONNACK.
During re-authentication, ordinary traffic can continue under the previous
authentication until Server AUTH `0x00` or failure. On failure, close the Network
Connection (MUST) and first send an appropriate DISCONNECT (SHOULD).

### MQTT 5 WebSocket transport

The Client MUST offer `mqtt` and the Server MUST select and return `mqtt` as the
WebSocket subprotocol. The URI is deployment-specific. Send Control Packets in
binary data frames; close the Network Connection on any other type of data frame.
Parse binary data as a byte stream: a frame can contain part of a Control Packet
or several Control Packets.

Files in this skill

  • SKILL.md9 KB
  • coverage.json1.1 KB
  • references/mqtt-sn-authentication-and-protection.md5.1 KB
  • references/mqtt-sn-migration-and-wire.md11.2 KB
  • references/mqtt-sn-sessions-and-delivery.md8.6 KB
  • references/mqtt5-framing-and-properties.md4.7 KB
  • references/mqtt5-operations-and-transports.md2.8 KB
  • references/mqtt5-publish-and-subscriptions.md5.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.