update Do 30. Apr 12:31:01 CEST 2020

This commit is contained in:
Robert Richter 2020-04-30 12:31:01 +02:00
parent dd2dc48407
commit 372d3c3244
2 changed files with 22 additions and 28 deletions

View File

@ -240,15 +240,15 @@ socket.on('connect_error', function (err) {
socket.on('io.version', function (server_id) { socket.on('io.version', function (server_id) {
// TODO: socket.emit(lade client xxx neu) // TODO: socket.emit(lade client xxx neu)
if (client_id != server_id) { if (client_id != server_id) {
$('#waipModal').modal('hide');
setTimeout(function () {
$('#waipModalTitle').html('ACHTUNG'); $('#waipModalTitle').html('ACHTUNG');
$('#waipModalBody').html('Neue Server-Version. Seite wird in 10 Sekunden neu geladen!'); $('#waipModalBody').html('Neue Server-Version. Seite wird in 10 Sekunden neu geladen!');
if ($('#waipModal').hasClass('in')) {
$('#waipModal').modal('hide');
};
$('#waipModal').modal('show'); $('#waipModal').modal('show');
setTimeout(function () { setTimeout(function () {
location.reload(); location.reload();
}, 10000); }, 10000);
}, 1000);
}; };
}); });
@ -523,7 +523,7 @@ function calcSpeed(prev, next) {
/* ####### Rückmeldung ####### */ /* ####### Rückmeldung ####### */
/* ########################### */ /* ########################### */
$('#rueckmeldung').each(function (index) { /*$('#rueckmeldung').each(function (index) {
$(this).on("click", function () { $(this).on("click", function () {
$('#responseModal').modal('show'); $('#responseModal').modal('show');
}); });
@ -537,7 +537,7 @@ $('#send_response').on('click', function () {
respo.fuehrungskraft = $('#radios_res_fk').prop('checked'); respo.fuehrungskraft = $('#radios_res_fk').prop('checked');
respo.atemschutz = $('#cb_res_agt').prop('checked'); respo.atemschutz = $('#cb_res_agt').prop('checked');
socket.emit('response', waip_id, respo); socket.emit('response', waip_id, respo);
}); });*/

View File

@ -10,19 +10,12 @@ module.exports = function (io, sql, tw, async, app_cfg) {
if (socket_rooms) { if (socket_rooms) {
socket_rooms.forEach(function (rooms) { socket_rooms.forEach(function (rooms) {
// fuer jede Wache(rooms.room) die verbundenen Sockets(Clients) ermitteln und den Einsatz verteilen // fuer jede Wache(rooms.room) die verbundenen Sockets(Clients) ermitteln und den Einsatz verteilen
var room_sockets = io.nsps['/waip'].adapter.rooms[rooms.room];
var room_sockets = io.nsps['/waip'].adapter.rooms[rooms.room];//.sockets; if (typeof room_sockets !== 'undefined'){
console.log(room_sockets); Object.keys(room_sockets.sockets).forEach(function (socket_id) {
if (typeof room_sockets !== 'undefined'){ // ) { var socket = io.of('/waip').connected[socket_id];
Object.keys(room_sockets.sockets).forEach(function (socket) { waip_verteilen(waip_id, socket, rooms.room);
console.log(socket);
if (typeof socket !== 'undefined') {
var socket_real = io.of('/waip').connected[socket];
console.log(socket_real);
waip_verteilen(waip_id, socket_real, rooms.room);
sql.db_log('WAIP', 'Einsatz ' + waip_id + ' wird an ' + socket.id + ' (' + rooms.room + ') gesendet'); sql.db_log('WAIP', 'Einsatz ' + waip_id + ' wird an ' + socket.id + ' (' + rooms.room + ') gesendet');
};
}); });
}; };
}); });
@ -260,10 +253,11 @@ module.exports = function (io, sql, tw, async, app_cfg) {
if (data) { if (data) {
data.forEach(function (row) { data.forEach(function (row) {
// fuer jede Wache(row.room) die verbundenen Sockets(Clients) ermitteln und Standby senden // fuer jede Wache(row.room) die verbundenen Sockets(Clients) ermitteln und Standby senden
var room_stockets = io.sockets.adapter.rooms[row.room]; var room_sockets = io.nsps['/waip'].adapter.rooms[row.room];
if (typeof room_stockets !== 'undefined') { if (typeof room_sockets !== 'undefined') {
Object.keys(room_stockets).forEach(function (socket) { Object.keys(room_sockets.sockets).forEach(function (socket_id) {
// Standby senden // Standby senden
var socket = io.of('/waip').connected[socket_id];
sql.db_check_client_waipid(socket.id, waip_id, function (same_id) { sql.db_check_client_waipid(socket.id, waip_id, function (same_id) {
if (same_id) { if (same_id) {
socket.emit('io.standby', null); socket.emit('io.standby', null);