Latest 0.3.0
Homepage https://github.com/andy1247008998/MQTT
License MIT
Platforms ios 12.0
Authors

CI Status
Version
License
Platform

Introduction

This is a MQTT v5.0 client for Swift based on Apple’s Network.framework.

MQTT Version 5.0: http://docs.oasis-open.org/mqtt/mqtt/v5.0/cs02/mqtt-v5.0-cs02.html

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

This project is still under development. DO NOT use it in production!

PRs are warmly welcomed!

Requirements

iOS 12.0+ / macOS 10.14+

Swift 4.2

Broker with MQTT v5.0 support

Installation

MQTT is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'MQTT'

Usage

/// In your AppDelegate or UIViewController
import MQTT
mqtt = MQTT(clientID: clientID, host: "mqtt.example.com", port: 1883, username: username, password: password)
mqtt.delegate = self
mqtt.cleanSession = false
mqtt.start()

/// You MUST stop MQTT service when app did enter background, otherwise NWConnection will fail and NSTimer won't stop!
func applicationDidEnterBackground(_ application: UIApplication) {
mqtt.stop()
}

/// MQTT will start a new connection between client and broker.
func applicationWillEnterForeground(_ application: UIApplication) {
mqtt.start()
}

Author

andy1247008998

License

MQTT is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "MQTT",
    "version": "0.3.0",
    "summary": "MQTT v5.0 client for Swift",
    "description": "TODO: Add long description of the pod here.",
    "homepage": "https://github.com/andy1247008998/MQTT",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "andy1247008998": "[email protected]"
    },
    "source": {
        "git": "https://github.com/andy1247008998/MQTT.git",
        "tag": "0.3.0"
    },
    "platforms": {
        "ios": "12.0"
    },
    "source_files": "MQTT/Classes/**/*",
    "swift_version": "4.2"
}

Pin It on Pinterest

Share This