Closed eternaltao closed 8 years ago
Invalid Message Format
{ uuid: '58d52aae-3ae6-499f-8224-a0661bf07deb',
message: 'LIST' }
The message emit event is
socket.emit('message', {uuid:"58d52aae-3ae6-499f-8224-a0661bf07deb", message:"LIST"});
but not
socket.emit('message', {devices:"58d52aae-3ae6-499f-8224-a0661bf07deb", message:"LIST"});
And there's something wrong with the callback(new Error('Invalid Message Format')), I use a console.log to replace it.
meshblu-1.17.12/lib/sendMessage.js:213:7
if(!data.devices) {
console.log("Invalid Message Format");
console.log(data);
//callback(new Error('Invalid Message Format'));
return;
}
@eternaltao the proper format for a message would be:
{"devices": ["my-uuid"], "topic": "greetings", "message": "hello"}
However it shouldn't cause Meshblu to crash, so I committed a fix for it.
FYI: This Meshblu repo has been deprecated, we have moved towards a more micro-service architecture. We should have documentation on how to use it soon but for now, you can look at the meshblu-core-* and meshblu-protocol-* repos.
Hello, I build and run a Meshblu (1.17.12) server in my VMware. ··· node server.js --http ···
And when I send messages it always crashed: ··· TypeError: callback is not a function at Object.sendMessage (/data/meshblu-1.17.12/lib/sendMessage.js:213:7) at /data/meshblu-1.17.12/lib/socketLogic.js:707:16 at /data/meshblu-1.17.12/lib/socketLogic.js:38:14 at /data/meshblu-1.17.12/lib/whoAmI.js:10:5 at deviceFound (/data/meshblu-1.17.12/lib/getDevice.coffee:6:5) at deviceFound (/data/meshblu-1.17.12/lib/getDeviceWithToken.coffee:16:5) at /data/meshblu-1.17.12/lib/models/device.coffee:65:18 at /data/meshblu-1.17.12/lib/findCachedDevice.coffee:18:5 at try_callback (/data/meshblu-1.17.12/node_modules/redis/index.js:573:9) at RedisClient.return_reply (/data/meshblu-1.17.12/node_modules/redis/index.js:661:13) at RedisClient.wrapper as return_reply at HiredisReplyParser. (/data/meshblu-1.17.12/node_modules/redis/index.js:309:14)
at emitOne (events.js:77:13)
at HiredisReplyParser.emit (events.js:169:7)
at HiredisReplyParser.execute (/data/meshblu-1.17.12/node_modules/redis/lib/parser/hiredis.js:43:18)
at RedisClient.on_data (/data/meshblu-1.17.12/node_modules/redis/index.js:534:27)
at RedisClient.wrapper (/data/meshblu-1.17.12/node_modules/lodash/index.js:3095:19)
at Socket. (/data/meshblu-1.17.12/node_modules/redis/index.js:91:14)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at Socket.Readable.push (_stream_readable.js:110:10)
at TCP.onread (net.js:523:20)
···
How can I fix this problem?