Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with Websocket MQTT #235

Open
roussetp opened this issue Mar 5, 2021 · 1 comment
Open

Problem with Websocket MQTT #235

roussetp opened this issue Mar 5, 2021 · 1 comment

Comments

@roussetp
Copy link

roussetp commented Mar 5, 2021

**Hello

Here is my code that generates the following error message in my browser console. Thanks very much to help me !**

The code :

<title>MQTT</title> <script src="mqttws31.js" type="text/javascript"></script>-->

Connexion MQTT :

<script type="text/javascript">
// Create a client instance
client = new Paho.MQTT.Client("b37.mqtt.one", 8083,"client_id");

// set callback handlers
client.onConnectionLost = onConnectionLost;
client.onMessageArrived = onMessageArrived;
var options = {
    //timeout: 3,
    useSSL: true,
    userName: "260fqs693",
    password: "469efgijsu",
    onSuccess:onConnect,
    onFailure:doFail
}

// connect the client
client.connect(options);


// called when the client connects
function onConnect() {
    // Once a connection has been made, make a subscription and send a message.
    console.log("onConnect");
    client.subscribe("260fqs693/Entrant");
    message = new Paho.MQTT.Message("Hello");
    message.destinationName = "260fqs693/Sortant";
    client.send(message);
}

function doFail(e){
    console.log(e);
}

// called when the client loses its connection
function onConnectionLost(responseObject) {
    if (responseObject.errorCode !== 0) {
    console.log("onConnectionLost:"+responseObject.errorMessage);
    }
}

// called when a message arrives
function onMessageArrived(message) {
    console.log("onMessageArrived:"+message.payloadString);
}
</script>

The message on console :
Capture2

@mridah
Copy link

mridah commented May 13, 2021

@roussetp Were you able to resolve this ? I'm facing the same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants