1
0
mirror of https://github.com/mainflux/mainflux.git synced 2025-04-27 13:48:49 +08:00

Changed RawMessage (#587)

Signed-off-by: nmarcetic <n.marcetic86@gmail.com>
This commit is contained in:
Nikola Marčetić 2019-02-11 14:27:56 +01:00 committed by GitHub
parent 94574e3707
commit 434a57d8e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,12 +83,12 @@ function startMqtt() {
nats.subscribe('channel.*', {'queue':'mqtts'}, function (msg) {
var m = message.RawMessage.decode(Buffer.from(msg)),
packet;
if (m && m.Protocol !== 'mqtt') {
if (m && m.protocol !== 'mqtt') {
packet = {
cmd: 'publish',
qos: 2,
topic: 'channels/' + m.Channel + '/messages',
payload: m.Payload,
topic: 'channels/' + m.channel + '/messages',
payload: m.payload,
retain: false
};
@ -128,10 +128,10 @@ aedes.authorizePublish = function (client, packet, publish) {
logger.info('authorized publish');
rawMsg = message.RawMessage.encode({
Publisher: client.thingId,
Channel: channelId,
Protocol: 'mqtt',
Payload: packet.payload
publisher: client.thingId,
channel: channelId,
protocol: 'mqtt',
payload: packet.payload
});
nats.publish(channelTopic, rawMsg);