mirror of
https://github.com/mainflux/mainflux.git
synced 2025-04-29 13:49:28 +08:00
Update mqtt to mqtt communication to support full protocol (#408)
Signed-off-by: Aleksandar Novakovic <aleksandar.novakovic@mainflux.com>
This commit is contained in:
parent
d5f0d7d225
commit
70517bd907
@ -63,6 +63,8 @@ function startMqtt() {
|
||||
|
||||
nats.subscribe('channel.*', function (msg) {
|
||||
var m = message.RawMessage.decode(Buffer.from(msg)),
|
||||
packet;
|
||||
if (m && m.Protocol !== 'mqtt') {
|
||||
packet = {
|
||||
cmd: 'publish',
|
||||
qos: 2,
|
||||
@ -71,7 +73,8 @@ nats.subscribe('channel.*', function (msg) {
|
||||
retain: false
|
||||
};
|
||||
|
||||
aedes.publish(packet);
|
||||
aedes.publish(packet);
|
||||
}
|
||||
});
|
||||
|
||||
aedes.authorizePublish = function (client, packet, publish) {
|
||||
@ -100,8 +103,6 @@ aedes.authorizePublish = function (client, packet, publish) {
|
||||
});
|
||||
nats.publish('channel.' + channelId, rawMsg);
|
||||
|
||||
// Set empty topic for packet so that it won't be published two times.
|
||||
packet.topic = '';
|
||||
publish(0);
|
||||
} else {
|
||||
logger.warn("unauthorized publish: %s", err.message);
|
||||
|
Loading…
x
Reference in New Issue
Block a user