-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConcentratore.js
33 lines (31 loc) · 1.17 KB
/
Concentratore.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
exports.concentratore = (function(sock, mongoose){
var critical = 1;
var warning = 2;
var informational = 3;
var Schema = mongoose.Schema;
var eccezioneSchema = new Schema({
'mittente': { type: String, index: true },
'messaggio': String
});
var eccezioneModel= mongoose.model('eccezioneModel', eccezioneSchema);
console.log("Prova concentratore");
function handleEccezione(messaggio, mittente){
var newEccezione = new eccezioneModel({
mittente: mittente,
messaggio: messaggio
});
newEccezione.save(function (err) {
if (err)
console.log(err);
notificaEccezioneGestita();
});
}
function notificaEccezioneGestita(){
sock.sockets.on('connection', function (s) {
s.emit('eccezioneGestitaEvent', { data: 'ok' });
});
}
return {
getEccezione: handleEccezione
};
});