octoblu / meshblu

Meshblu is a cross-protocol IoT machine-to-machine messaging system.
https://meshblu.readme.io/
MIT License
816 stars 181 forks source link

How to set messageHooks and messageForward #121

Closed eternaltao closed 8 years ago

eternaltao commented 8 years ago

I'm getting stuck in message forwarding on my local meshblu server.

I have two devices to connect meshblu, client A and client B which use socket.io.

when I connect to the "http://meshblu.octoblu.com", A can emit a message and B can receive.(A is in B's sendWhitelist)

but when I connect to my local meshblu server, A( with local uuid and token) and B can connect and identity well ,but B can't receive the message from A.

and I looked into the code:

~/meshblu/lib/sendMessage.js

function messageForward(toDevice, emitMsg, callback){
    var benchmark = new Benchmark({label: 'messageForward'});
    if (!toDevice.meshblu) {
      return callback()
    }
    doMessageHooks(toDevice, toDevice.meshblu.messageHooks, emitMsg, function(error) {
      doMessageForward(toDevice.meshblu.messageForward, emitMsg, toDevice.uuid, function(error, messages) {
        async.each(messages, function(msg, done){
          ...
          ...
          ...
      });
    });
  }

I don't know how to set "toDevice.meshblu.messageHooks" and "toDevice.meshblu.messageForward",
because of these, the messages is empty, so "async.each(messages, function(msg, done)" do nothing.

I use ubuntu12.04 node 4.2.3 And I tried meshblu version 1.17, 1.16 and 1.14, and node_moules npm installed , still have the same problem.

eternaltao commented 8 years ago

I fixed it.

redis-server is not started...

囧rz ...