Coder Social home page Coder Social logo

Comments (3)

arcoirislabs avatar arcoirislabs commented on August 22, 2024

Sure we will give a looks at the issue.

Open source team
Arcoiris Labs

On 14-May-2016, at 8:25 PM, Ion [email protected] wrote:

Please help me with the following:
I use https://build.phonegap.com to build your sampleapp. I tried to connect to tcp://test.mosquitto.org port 1883, but I received --> You got `disconnected and never succed to connect.

Config.xml is:

<widget xmlns  = "http://www.w3.org/ns/widgets"
    xmlns:gap     = "http://phonegap.com/ns/1.0"
    id                   = "com.phonegap.example"
    versionCode = "10" 
    version     = "1.0.0" >
<name>Test</name>
<platform name="android" />
<description>Test</description>
<preference name="android-build-tool" value="gradle" /> 
<gap:plugin name="cordova-plugin-mqtt" spec="0.2.7" source="npm" />
<preference name="phonegap-version" value="cli-5.2.0" />
<preference name="orientation"      value="default" />
<preference name="target-device"    value="universal" />
<preference name="fullscreen"       value="false" />
<preference name="webviewbounce"    value="false" />


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub

from cordova-plugin-mqtt.

arcoirislabs avatar arcoirislabs commented on August 22, 2024

@ionciubotaru
We looked into the issue and we found no issues with the connection part.
Our config.xml was this

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.phonegap.helloworld" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
    <name>Hello World</name>
    <description>
        Hello World sample application that responds to the deviceready event.
    </description>
    <author email="[email protected]" href="http://phonegap.com">
        PhoneGap Team
    </author>
    <content src="index.html" />
    <preference name="DisallowOverscroll" value="true" />
    <preference name="android-minSdkVersion" value="14" />
    <preference name="android-build-tool" value="gradle" />
    <gap:plugin name="cordova-plugin-mqtt" spec="0.2.7" source="npm" />
    <preference name="phonegap-version" value="cli-5.2.0" />
    <preference name="orientation"      value="default" />
    <preference name="target-device"    value="universal" />
    <preference name="fullscreen"       value="false" />
    <preference name="webviewbounce"    value="false" />
    <icon src="icon.png" />
    <platform name="android">
        <icon density="ldpi" src="www/res/icon/android/drawable-ldpi-icon.png" />
        <icon density="mdpi" src="www/res/icon/android/drawable-mdpi-icon.png" />
        <icon density="hdpi" src="www/res/icon/android/drawable-hdpi-icon.png" />
        <icon density="xhdpi" src="www/res/icon/android/drawable-xhdpi-icon.png" />
        <icon density="xxhdpi" src="www/res/icon/android/drawable-xxhdpi-icon.png" />
        <icon density="xxxhdpi" src="www/res/icon/android/drawable-xxxhdpi-icon.png" />
        <splash density="land-ldpi" src="www/res/screen/android/drawable-land-ldpi-screen.png" />
        <splash density="land-mdpi" src="www/res/screen/android/drawable-land-mdpi-screen.png" />
        <splash density="land-hdpi" src="www/res/screen/android/drawable-land-hdpi-screen.png" />
        <splash density="land-xhdpi" src="www/res/screen/android/drawable-land-xhdpi-screen.png" />
        <splash density="land-xxhdpi" src="www/res/screen/android/drawable-land-xxhdpi-screen.png" />
        <splash density="land-xxxhdpi" src="www/res/screen/android/drawable-land-xxxhdpi-screen.png" />
        <splash density="port-ldpi" src="www/res/screen/android/drawable-port-ldpi-screen.png" />
        <splash density="port-mdpi" src="www/res/screen/android/drawable-port-mdpi-screen.png" />
        <splash density="port-hdpi" src="www/res/screen/android/drawable-port-hdpi-screen.png" />
        <splash density="port-xhdpi" src="www/res/screen/android/drawable-port-xhdpi-screen.png" />
        <splash density="port-xxhdpi" src="www/res/screen/android/drawable-port-xxhdpi-screen.png" />
        <splash density="port-xxxhdpi" src="www/res/screen/android/drawable-port-xxxhdpi-screen.png" />
    </platform>

    <access origin="*" />
    <allow-intent href="http://*/*" />
    <allow-intent href="https://*/*" />
    <allow-intent href="tel:*" />
    <allow-intent href="sms:*" />
    <allow-intent href="mailto:*" />
    <allow-intent href="geo:*" />
    <platform name="android">
        <allow-intent href="market:*" />
    </platform>
    <platform name="ios">
        <allow-intent href="itms:*" />
        <allow-intent href="itms-apps:*" />
    </platform>
</widget>

And our connection configuration was this

cordova.plugins.CordovaMqTTPlugin.connect({
    url:"tcp://test.mosquitto.org", //a public broker used for testing purposes only. Try using a self hosted broker for production.
    port:1883, 
    clientId:"arcoirislabs",
    connectionTimeout:3000,
    willTopicConfig:{
        qos:0,
        retain:true,
        topic:"<will topic>",
        payload:"<will topic message>"
    },
    keepAlive:60,
    success:function(s){
        console.log("connect success");
    },
    error:function(e){
        console.log("connect error");
    },
    onConnectionLost:function (){
        console.log("disconnect");
    }
})

And it worked perfectly fine. If you need we can provide you the APK.

from cordova-plugin-mqtt.

arcoirislabs avatar arcoirislabs commented on August 22, 2024

@ionciubotaru
We tried to recreate the issue and it seems that either you used credentials for a public broker or the client ID's length exceed the 24 chars length limit.
If you still got any issues, do let us know.
We will be glad to help you.

Open Source Team
Arcoiris Labs

from cordova-plugin-mqtt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.