You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.
`exports.get_live_measure = function(req, res) {
var client = mqtt.connect('mqtt://192.168.1.193');
client.publish(req.params.typeId,req.params.sensorId)
client.subscribe('response')
client.on('message', function (topic, message) {
res.json(message.toString());
client.end();
});
};`
In this code, when i'm sending an API call for some devices who are not supposed to give a response, the code get stuck at the instruction client.on('message').
Is there any way to skip stop/skip the instruction after an amount of time? or a way to manage this situation.
The text was updated successfully, but these errors were encountered:
@crapthings thanks for the answer, but unfortunately nothing changes. the problem actually comes from the client.on("message") which enter in an infinite loop waiting for the response, but for an inexistant device there is no response, consequently, it will stick permanently there waiting for a never sent response, until i restart the server.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
`exports.get_live_measure = function(req, res) {
var client = mqtt.connect('mqtt://192.168.1.193');
client.publish(req.params.typeId,req.params.sensorId)
client.subscribe('response')
client.on('message', function (topic, message) {
res.json(message.toString());
client.end();
});
};`
In this code, when i'm sending an API call for some devices who are not supposed to give a response, the code get stuck at the instruction client.on('message').
Is there any way to skip stop/skip the instruction after an amount of time? or a way to manage this situation.
The text was updated successfully, but these errors were encountered: