gausby/tortoise
58.4
Adequate · 18 September 2026
3.7k
lines of production code
Elixir
primary language
1
measurement over time
What this system is
Tortoise is an open-source MQTT client library for the Erlang ecosystem that manages persistent connections over TCP and SSL transports. It provides reliable message delivery by tracking in-flight QoS 1 and QoS 2 packets, handling reconnection backoffs, and exposing connection status events via a pubsub registry. The system allows users to define custom logic through a handler behavior or use built-in default and logger implementations for common use cases.
Features
Add SSL transport support with secure defaults
Users can now establish secure MQTT connections using the new SSL transport layer. The implementation defaults to \verify\_peer\ mode, requiring clients to provide trusted CA certificates or explicitly opt out of verification via \verify: :verify\_none\. The transport also handles host name coercion to charlists and uses the modern \:ssl.handshake/2\ API for compatibility with OTP 24+.
lib/tortoise/transport · high confidence
Initial release of Tortoise MQTT client with Apache 2.0 license
This entry marks the initial open-source release of the Tortoise MQTT client library. The project now includes a comprehensive CHANGELOG documenting features and fixes from version 0.1.0 through 0.10.0, such as SSL support, connection status pubsub events, and handler macros. The repository is licensed under Apache 2.0, and the README has been updated with installation instructions, usage examples for TCP and SSL connections, and an upgrade path for API changes in v0.9.0. Additionally, build and CI configurations are established, including SemaphoreCI badges, dialyzer ignore files, and coveralls configuration.
(repo-wide) · high confidence
Introduces event pubsub, handler behavior, and pipe-based publishing
Tortoise now exposes a \Tortoise.Events\ registry that allows users to subscribe to connection status changes (\:up\/\:down\) and ping response times for custom metrics or logging. The library introduces a \Tortoise.Handler\ behavior, replacing the previous \Tortoise.Driver\, to let users define callbacks for connection lifecycle events, message handling, and subscription status changes via a \next\_actions\ mechanism. Additionally, an experimental \Tortoise.Pipe\ API is added, enabling processes to obtain a transmitter handle for asynchronous publishing and awaiting acknowledgments for QoS 1/2 messages. The legacy \Tortoise.InFlightRegistry\ and \Tortoise.Driver\ modules have been removed in favor of these new abstractions.
lib/tortoise · high confidence
Introduces stateful tracking for in-flight MQTT control packets
A new \Tortoise.Connection.Inflight.Track\ module has been added to manage the lifecycle of MQTT control packets (Publish QoS 1/2, Subscribe, Unsubscribe) that are currently in transit. This component tracks the state of outgoing and incoming packets, ensuring that acknowledgments (Puback, Pubrec, Pubrel, Pubcomp, Suback) are correctly matched to their originating requests and that the calling processes are notified upon completion. This change provides the underlying mechanism for reliable message delivery and subscription management within the connection layer.
lib/tortoise/connection/inflight · high confidence
New default and logger handlers for MQTT connection events
The library now includes built-in handler modules for common use cases. Tortoise.Handler.Default provides a minimal implementation using the new handler macro, while Tortoise.Handler.Logger automatically logs connection status changes (up/down/terminating), subscription events (including warnings when requested QoS differs from accepted), message payloads, and termination reasons to the standard Logger.
lib/tortoise/handler · high confidence
Behavioural changes
Refactor connection architecture with dedicated inflight tracking and backoff strategy
The connection module has been restructured to improve reliability and separation of concerns. A new \Tortoise.Connection.Backoff\ module implements an incremental backoff strategy for reconnection attempts, replacing previous logic. The \Tortoise.Connection.Transmitter\ module has been removed and its responsibilities moved to a new \Tortoise.Connection.Inflight\ module, which now uses \GenStateMachine\ to manage in-flight QoS 1 and QoS 2 messages, ensuring proper ordering and retransmission after reconnects. The \Controller\ now delegates handler execution to a dedicated \Handler\ module and exposes \ping/1\ and \ping\_sync/2\ for monitoring connection health. Additionally, the \Receiver\ has been updated to support both TCP and SSL transports and dispatches status changes via \Tortoise.Events\.
lib/tortoise/connection · high confidence
Removal of legacy in-flight message tracking module
The \Tortoise.Connection.Transmitter.Inflight\ module has been removed from the library. This change eliminates the previous state-machine implementation used to track the lifecycle of MQTT control packets (such as Publish, Puback, Pubrec, Pubrel, and Pubcomp) during transmission. Users relying on internal implementation details of this module will need to adjust, as the in-flight state management is now handled differently within the Tortoise connection architecture.
lib · high confidence
Stricter MQTT protocol validation and encoding in package structs
The package structs in lib/tortoise/package now enforce stricter adherence to the MQTT specification. Key changes include: 1) Enforcing required keys (e.g., :status in Connack, :client\_id in Connect, :identifier in Puback/Pubcomp/Pubrec/Pubrel/Suback/Unsuback) via @enforce\_keys. 2) Allowing nil for optional fields like :status in Connack and :will in Connect, with Connect encoding handling nil wills correctly. 3) Requiring at least one topic filter in Subscribe and Unsubscribe packages for encoding. 4) Rejecting empty subscription lists in Suback decoding. 5) Standardizing package\_identifier types and ensuring identifiers are enforced where required. 6) Handling empty payloads by converting them to nil in Publish and Connect decoding, and encoding nil payloads as empty strings.
lib/tortoise/package · high confidence
Test coverage
Added scripted MQTT server and transport test helpers; Added test coverage for Tortoise core modules; Added tests for MQTT subscription QoS handling; Added tests for connection backoff, inflight tracking, and receiver logic; Added tests for the MQTT inflight message tracking logic; Expanded test coverage for MQTT publish flows and protocol constraints.
Dependencies
Upgrade to version 0.10.0 with expanded dependencies and tooling
The project has been updated to version 0.10.0, introducing several new dependencies and configuration changes. The \gen\_state\_machine\ dependency has been relaxed to support both version 2.0 and 3.0, with the lock file reflecting an upgrade to 3.0.0. New development and test dependencies have been added, including \dialyxir\ for static analysis, \ex\_doc\ for documentation generation, \excoveralls\ for test coverage reporting, and \ct\_helper\ for Common Test integration. The \eqc\_ex\ dependency is now restricted to the test environment only. Additionally, the project configuration now includes settings for dialyzer, documentation, and test coverage, and the application module has been updated to start \Tortoise.App\ with SSL support enabled.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 58.
Lenses
- Code Health 99
- Architecture 100
- Maturity 46
- Readiness 42
- Security 98
Changes since last survey
- 300 commits — 285 feature/other, 15 fixes
By area
- lib/tortoise — 121 commits
- (root) — 79 commits
- (repo) — 57 commits
- test/tortoise — 15 commits
- docs/connecting_to_a_mqtt_broker.md — 9 commits
- lib/tortoise.ex — 8 commits
- docs/introduction.md — 5 commits
- docs/publishing_messages.md — 3 commits
- docs/connection_supervision.md — 2 commits
- test/support — 1 commit
Notable commits
- fix: Bumping timeouts on some tests to fix broken builds TravisCI
- fix: Fix a dialyzer warning
- fix: Fix a pattern match (it is :error instead of :stop)
- fix: Fix all the current dialyzer warnings
- fix: Fix an example in the changelog
- fix: Fix an issue in the receiver that made it crash on larger messages
- fix: Fix ex_doc include in mix file
- fix: Fix spec error in Tortoise.Registry
- fix: Merge pull request #108 from rbino/fix-key-format-in-docs
- fix: Merge pull request #110 from rbino/fix-connection-start-link-typespec
- fix: Merge pull request #136 from jfcloutier/otp-24-fix
- fix: Merge pull request #41 from gausby/fix-larger-message-handling-in-the-receiver
- fix: Merge pull request #53 from gausby/fix-slow-connections
- fix: Update the changelog with recent fixes
- fix: Version 0.4.3 fix last will configuration option
- change: A valid unsubscribe package must contain at least one topic filter
- change: Add @impl true to @behaviour implementations that missed them
- change: Add a Changelog & info needed by Hex in prep for releasing it on Hex
- change: Add a Tortoise.Events registry
- change: Add a longer timeout on a test that started to fail on Travis
- …and 280 more
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
gausby/tortoise was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 18 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit b346faf911d8902b0ada543d109d27b07ad61a48 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-5d04157a340d.