A native Swift library for MQTT 5.0 and 3.1.1 communication on iOS, macOS, and tvOS.
CocoaMQTT is an MQTT client library written in Swift for iOS, macOS, and tvOS applications. It enables devices and apps to publish and subscribe to messages using the lightweight MQTT protocol, which is commonly used in IoT, real-time messaging, and mobile connectivity scenarios. The library supports both MQTT 5.0 and 3.1.1 specifications, providing a native solution for Apple ecosystem developers.
iOS, macOS, and tvOS developers building applications that require lightweight messaging, IoT device communication, or real-time data sync with MQTT brokers.
Developers choose CocoaMQTT for its native Swift implementation, support for the latest MQTT 5.0 features, and seamless integration with Apple's platforms, including SSL security and WebSocket transport options.
MQTT 5.0 client library for iOS and macOS written in Swift
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Supports both MQTT 5.0 and 3.1.1 specifications, with separate CocoaMQTT5 and CocoaMQTT classes in the usage examples, ensuring compatibility with modern and legacy brokers.
Provides one-way and two-way certificate authentication, including code snippets for allowing untrusted CA certificates and generating .p12 files with OpenSSL.
Enables MQTT over WebSocket and WSS with the CocoaMQTTWebSocket class and Starscream dependency, allowing custom headers and secure connections as shown in the setup steps.
Written in Swift 5 with support for delegate patterns and closure-based callbacks, making it idiomatic and easy to integrate into Apple platform codebases.
Relies on third-party sockets like MqttCocoaAsyncSocket and Starscream for WebSocket, which can introduce version conflicts, maintenance overhead, and increased project complexity.
Two-way SSL requires manual generation of .p12 files with specific OpenSSL versions (e.g., 1.1), adding error-prone setup steps not needed in simpler clients.
Only compatible with iOS, macOS, and tvOS, excluding watchOS and non-Apple platforms, which restricts its use in cross-platform or hybrid app scenarios.
Enabling WebSocket support necessitates additional imports and configurations, such as importing CocoaMQTTWebSocket and Starscream, unlike streamlined TCP-based MQTT setups.