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

Cross-protocol send/Receive messages #129

Open
anhldbk opened this issue May 4, 2016 · 0 comments
Open

Cross-protocol send/Receive messages #129

anhldbk opened this issue May 4, 2016 · 0 comments

Comments

@anhldbk
Copy link

anhldbk commented May 4, 2016

(This issue is somewhat related to issue #128 )

I want to make 2 devices talk to each other via different protocols. To connect to Meshblu, I have:

Device A - Publisher

A uses WebSocket to connect to Meshblu, publishing broadcast messages periodically:

var meshblu = require('meshblu');
var config = {
    "uuid": "e5102de3-737b-4952-9fd5-e9ddfa953c97",
    "token": "2b6d92b6c4a6d51f9a82465d4260113d5f93f551",
    "hostname": "meshblu.octoblu.com",
    "port": 9630
}
var conn = meshblu.createConnection(config);

conn.on('ready', function(data){
    setInterval(function(){
        console.log("sending message");
        conn.message({
            "devices": "*",
            "payload": {
                "hello":"world"
            }
        });
    },300);
});

A is already configured to allow any device receiving its broadcast messages:

"receiveWhitelist": [
        "*"
],

Device B - Subscriber

B uses MQTT , subscribing to A to receive messages

var Meshblu = require('meshblu-mqtt');
var config = {
    "uuid": "9f9366a5-c738-4a59-b681-a8964c0b4d7f",
    "token": "933093e4c2fc1522b49568e45a4cb80e316b7a68",
    "hostname": "meshblu.octoblu.com",
    "port": 1883
}

var conn = new Meshblu(config);
conn.connect(function(response){
    console.log('------------------------');
    console.log(response);
    console.log('------------------------');

    // subscribe to A
    conn.subscribe("e5102de3-737b-4952-9fd5-e9ddfa953c97", function(data){
        console.log(data)
    });

    conn.on('message', function(data){
        console.log('message received');
        console.log(data);
    });
})

The problem
B can't receive any message from A

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

1 participant