Home Network fully implemented

This commit is contained in:
Luis Fernando Molina committed 2020-04-24 13:40:42 +02:00
1 parent 2ed86e0118
commit a3efd3eaf0
19 files changed
+401 -74

No files matched your search

+10 -3
View File
@@ -1,4 +1,4 @@
exports.newEventsServerClient = function newEventsServerClient() {
exports.newEventsServerClient = function newEventsServerClient(host, port) {
const MODULE = "Task Server "
const ERROR_LOG = true
@@ -19,7 +19,14 @@
let WEB_SOCKETS_CLIENT
const WEB_SOCKET = require('ws')
let port = process.env.WEB_SOCKETS_SERVER_PORT
if (host === undefined) {
host = 'localhost'
}
if (port === undefined) {
port = process.env.WEB_SOCKETS_SERVER_PORT
}
return thisObject
@@ -32,7 +39,7 @@
function setuptWebSockets(callBackFunction) {
try {
WEB_SOCKETS_CLIENT = new WEB_SOCKET('ws://localhost:' + port )
WEB_SOCKETS_CLIENT = new WEB_SOCKET('ws://' + host + ':' + port )
WEB_SOCKETS_CLIENT.onerror = error => {
console.log('[ERROR] Task Server -> Event Server Client -> setuptWebSockets -> On connection error -> error = ' + JSON.stringify(error))