update Di 26. Mai 16:01:01 CEST 2020
This commit is contained in:
parent
0a47010425
commit
85834350fb
@ -3,26 +3,25 @@ module.exports = function (io, io_api, sql, app_cfg, waip) {
|
||||
// Module laden
|
||||
const io_api = require('socket.io-client');
|
||||
|
||||
|
||||
// Socket.IO API
|
||||
// Socket.IO API (anderer Server stellt Verbindung her und sendet Daten)
|
||||
|
||||
if (app_cfg.api.enabled) {
|
||||
// Namespace API
|
||||
var nsp_api = io.of('/api');
|
||||
|
||||
nsp_api.on('connection', function (socket) {
|
||||
// versuche Remote-IP zu ermitteln
|
||||
var remote_ip = socket.handshake.headers["x-real-ip"] || socket.handshake.headers['x-forwarded-for'] || socket.request.connection.remoteAddress;
|
||||
|
||||
//TODO pruefen ob Verbindung mit passendem Geheimnis und aus IP-Bereich
|
||||
//secret: 'asdfwert1234567890#',
|
||||
//access_list: ['192.168.2.20', '192.168.2.30']
|
||||
|
||||
// in Liste der Clients mit aufnehmen
|
||||
sql.db_update_client_status(socket, 'api');
|
||||
// Neuen Einsatz speichern
|
||||
socket.on('new_waip', function (data) {
|
||||
sql.db_log('API', 'Neuer Einsatz von ' + remote_ip + ': ' + data);
|
||||
waip.einsatz_speichern(data);
|
||||
sql.db_log('API', 'Neuer Einsatz von ' + remote_ip + ': ' + data);
|
||||
});
|
||||
// neue externe Rueckmeldung speichern
|
||||
socket.on('new_rmld', function (data) {
|
||||
sql.db_save_rmld(data, function (result) {
|
||||
if (result) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user