I create mqtt server with mosca. I implement authenticate in my server:
server.authenticate = function(client, username, password, callback) {
//check client id
const id = client.id;
var ip = '';
if (client && client.connection && client.connection.stream) {
ip = client.connection.stream.remoteAddress;
}
console.log("mqtt server authenticate " + id + " " + ip );
let authorized = (username === 'username' && password.toString() === 'password');
console.log("authenticate " + authorized);
callback(null, authorized);
};
I check ip of clients with:
netstat -nat | sort
I see some strange ip address that i can't log in my authenticate function. is there another way to connect to mosca server?
I create mqtt server with mosca. I implement authenticate in my server:
I check ip of clients with:
I see some strange ip address that i can't log in my authenticate function. is there another way to connect to mosca server?
Thanks