CocoaMQTT | MQTT 5.0 client library for iOS and macOS written in Swift | iOS library

 by   emqx Swift Version: 2.1.3 License: Non-SPDX

kandi X-RAY | CocoaMQTT Summary

kandi X-RAY | CocoaMQTT Summary

CocoaMQTT is a Swift library typically used in Mobile, iOS applications. CocoaMQTT has no bugs, it has no vulnerabilities and it has medium support. However CocoaMQTT has a Non-SPDX License. You can download it from GitHub.

MQTT v3.1.1 and v5.0 client library for iOS/macOS/tvOS written with Swift 5.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              CocoaMQTT has a medium active ecosystem.
              It has 1462 star(s) with 373 fork(s). There are 76 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 88 open issues and 222 have been closed. On average issues are closed in 202 days. There are 5 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of CocoaMQTT is 2.1.3

            kandi-Quality Quality

              CocoaMQTT has no bugs reported.

            kandi-Security Security

              CocoaMQTT has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              CocoaMQTT has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              CocoaMQTT releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of CocoaMQTT
            Get all kandi verified functions for this library.

            CocoaMQTT Key Features

            No Key Features are available at this moment for CocoaMQTT.

            CocoaMQTT Examples and Code Snippets

            No Code Snippets are available at this moment for CocoaMQTT.

            Community Discussions

            QUESTION

            Subscribe to MQTT topic in SwiftUI iOS application
            Asked 2020-Oct-11 at 07:31

            I'm writing a small iOS app to send MQTT messages to a broker which is hosted on a Raspberry Pi companion computer on my quadcopter. In the iOS app primary view, the app will connect to MQTT Broker (check), send messages associated with several buttons (check), and monitor various quadcopter telemetries such as mode, distance, and lat/long. The iPhone app will display the drones position and the user's position (check) on a map.

            The part I'm having issues with currently is having the app maintain a continuous subscription to a topic and then update several variables in the code. Currently, the code below contains the subscription line and "did receive message" code inside of of a button view which only works momentarily when that button is pressed.

            I've tried pasting this code in various places within the content view with no success; admittedly I'm a novice coder and Swift/iOS is very new to me. Ideally, the app would continually monitor certain topics and update several variables to equal the message when certain topics are posted to by the drone.

            ...

            ANSWER

            Answered 2020-Oct-11 at 07:31

            this is my first answer in StackOverflow and I'm a novice too. I was having the same problem, but I can solve it by declaring the "didConnectAck" for the mqttClient; the subscription remains. Just add the following missing lines to your code:

            Source https://stackoverflow.com/questions/64083961

            QUESTION

            How create thread safe variable in Swift 3?
            Asked 2020-Feb-21 at 00:33

            I have singleton class

            ...

            ANSWER

            Answered 2017-Mar-15 at 12:07

            Atomic properties won't help you here. They are intended to sync on assignment of the property as a whole and not of the internals (e.g. they do not sync insertion/removal of elements to the array). They almost only ensure correct retain/release/autorelease calls in order to keep your program from crashing / leaking.

            What you would need is Dispatch​Semaphore or something similar (or maybe more native stuff, posix pthread_mutex stuff) to ensure mutual exclusive access.

            Source https://stackoverflow.com/questions/42809121

            QUESTION

            Having problem connecting to my mqtt broker using CocoaMQTT
            Asked 2019-Oct-15 at 07:35

            I am making one iOS app communicating with Mqtt broker, mainly to publish message. But when I try to connect with broker using CocoaMQTT library it's always giving me error in connection.

            I am trying with CocoaMQTT latest version and also 1.1.3 version. But both are failing in connection and giving me error

            (Error Domain=kCFStreamErrorDomainNetDB Code=8 "nodename nor servname provided, or not known" UserInfo={NSLocalizedDescription=nodename nor servname provided, or not known})

            ...

            ANSWER

            Answered 2019-Jul-11 at 08:03

            As shown in the CocoaMQTT doc, the host entry in the init method should be just the hostname, not a URI:

            Source https://stackoverflow.com/questions/56982759

            QUESTION

            Why does MQTT keep disconnecting after it connects to a host on swift
            Asked 2019-Aug-13 at 12:41

            I have produced an app that connects to a raspberry pi's own wifi network and sends a message to give some data to it. I was using the cocoamqtt Library found here but I couldn't find a way to know when the client connects successfully or not so I move to the Moscapsule Library found here. I could easily connect to my pi with the cocoamqtt library, but whenever I try to connect to the pi with the Moscapsule library it just says 'Received DISCONNECT from iDevice' as soon as it makes a connection.

            Here's my code:

            ...

            ANSWER

            Answered 2019-Aug-13 at 12:41

            I'm going to go out on a limb here since I've never used Swift.

            The only reference to the mqtt client object client is as a local variable in the connect() method.

            Once this method returns the client object will go out of scope so will become eligible for Garbage Collection. I would assume that the client object has a destructor that calls disconnect before it is actually destroyed, hence the immediate disconnect.

            The fix is to make sure there is a reference to the client object that lives as long as you need it to.

            Source https://stackoverflow.com/questions/57468091

            QUESTION

            'ViewController' is not convertible to 'CocoaMQTTDelegate'?
            Asked 2019-Aug-02 at 11:58

            I'm trying to set up a connection using CocoaMQTT. The following example is provided on the GitHub page:

            https://github.com/emqx/CocoaMQTT/blob/master/Example/Example/ViewController.swift

            They are using a view controller 'self' as the delegate (see lines 53/63/74). However, when I try to use the view controller as the delegate, I get the error:

            ...

            ANSWER

            Answered 2019-Aug-02 at 11:58

            Thanks @Vollan for suggesting adding the extension at the bottom of the file. I probably should've noticed that. My bad.

            Source https://stackoverflow.com/questions/57321731

            QUESTION

            Swift 4 - CocoaMQTT not compatible anymore?
            Asked 2018-Oct-15 at 11:52

            I completed a few months ago a project with CocoaMQTT. Now I want to do a new project and I created the files like the one before. Now I get this error-codes. When I click the button to update the Code, I get new error-codes. Got someone the same problem or know a solution?

            ...

            ANSWER

            Answered 2018-Oct-15 at 11:52

            You are mixing Swift 3 and Swift 4 in your project. Because Swift 3 and Swift 4 are not source-compatible, this can not work. You need to either use Swift 3 for everything, or Swift 4 for everything.

            For CocoaMQTT there is a Swift 4.2 version available since Oct 12, 2018.
            SwiftyTimer looks abandoned, and there is no Swift 4 version of it yet (Oct 2018). It has been used by CocoaMQTT previously, but they have dropped that dependency with the new version. So there should be no problem once you upgrade CocoaMQTT, unless you are using SwiftyTimer yourself.

            You will need to support Swift 4 eventually (if not now, then in 1 year maybe). Maybe you can get away with staying with Swift 3 for now..

            Source https://stackoverflow.com/questions/52802376

            QUESTION

            MQTT sending messages over multiple ViewController
            Asked 2018-Oct-07 at 00:04

            i have a problem with my mqttconfiguration. Connection works fine. Every time I send a message, switch to another ViewController, come back and push again the sending button, no message received at my raspberry. So the problem is, when I switch over multiple ViewController I can't send messages anymore. I don't find my mistake in my code:

            Swiftfile for MQTT-Config:

            ...

            ANSWER

            Answered 2018-Oct-07 at 00:04

            It seems that you have tried to set up your MQTT client class as a singleton, but then code looks a little off.

            Use

            Source https://stackoverflow.com/questions/52681710

            QUESTION

            How to update UILabel with constantly updating data from MQTT publisher?
            Asked 2018-Feb-11 at 10:07

            I have a Raspberry Pi with a temperature sensor, that has a python script which constantly publishes the temperature using MQTT, and I have set the interval for every 1sec. In the iOS app I am making I have an MQTTManager class which has an mqttClient that subscribes to its topic and receives the string with the temperature. In the main view of my app I want to display the temperature and have it constantly updated, with the same (or close to the same) speed as the python script is sending it. The idea I have so far is to have the text of a UILabel be updated with the message string from the mqtt client message. I am not sure how update the label text correctly, with every sent publish event. I know I need to set up some kind of event handler for this message but I am not sure how to go about it. Any help will be appreciated.

            UPDATE: With the code that I have so far. This is my mqttManager:

            ...

            ANSWER

            Answered 2018-Feb-11 at 08:38

            I think you might solve it with a simple Notification. First you should add an observer where you want to update such label, doing so:

            Source https://stackoverflow.com/questions/48725950

            QUESTION

            How is the RestKit related to the new Watson Conversation SDK? Linker Error?
            Asked 2018-Jan-20 at 18:02

            I am going to update my customised sample based on Build a home assistant mobile application with Watson and IoT Platform services

            I did:

            1. carthage update --platform iOS
            2. did the pod install
            3. Using the autofix for the API Changes of the Watson Conversation Parameter inside xCode
            4. Asking a question about: How to handle a concrete situation with a parameter, here on Stack Overflow

            And now I got a linker error and I do not now is the error related to the update of the API or is it related to a newer xCode version, or the RestKit?

            In this code I get the message:

            d: framework not found RestKit clang: error: linker command failed with exit code 1 (use -v to see invocation)'

            ...

            ANSWER

            Answered 2018-Jan-20 at 18:02

            If you are using the latest release of the Watson Swift SDK, it no longer builds RestKit as a separate framework, but instead links it directly into each service. So you should be able to just remove the RestKit framework from your project.

            In your particular case, you need to select the Home Assistant Project in Xcode and then the Home Assistant target.

            In Build Phases, open "Link Binary with Libraries" item and delete RestKit.framework.

            Then in the "Run Script" phase, delete RestKit.framework from the input files list.

            With these two changes your app should build.

            Source https://stackoverflow.com/questions/48277430

            QUESTION

            How to set delegate to self inside init function?
            Asked 2017-Feb-24 at 08:29

            I have class named MQTTController with shared instance and a private init method

            ...

            ANSWER

            Answered 2017-Feb-24 at 07:37

            The error message told you what needs to be done, you need to call super.init() in your init.

            Source https://stackoverflow.com/questions/42432984

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install CocoaMQTT

            Build with Xcode 11.1 / Swift 5.1. IOS Target: 9.0 or above OSX Target: 10.12 or above TVOS Target: 10.0 or above.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/emqx/CocoaMQTT.git

          • CLI

            gh repo clone emqx/CocoaMQTT

          • sshUrl

            git@github.com:emqx/CocoaMQTT.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular iOS Libraries

            swift

            by apple

            ionic-framework

            by ionic-team

            awesome-ios

            by vsouza

            fastlane

            by fastlane

            glide

            by bumptech

            Try Top Libraries by emqx

            MQTTX

            by emqxTypeScript

            nanomq

            by emqxC

            neuron

            by emqxC

            qmqtt

            by emqxC++