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:
parent
94574e3707
commit
434a57d8e1
14
mqtt/mqtt.js
14
mqtt/mqtt.js
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user