Lots of updates

This commit is contained in:
Martin Donnelly 2020-02-12 13:21:47 +00:00
parent 0558b353b9
commit fa8833bc96
12 changed files with 217 additions and 154 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES5" />
<option name="languageLevel" value="ES6" />
</component>
</project>

View File

@ -2,11 +2,11 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="8a985735-5aff-47ce-a55f-2957d4f9c5f9" name="Default" comment="websocket stuff">
<change beforePath="$PROJECT_DIR$/.idea/jsLibraryMappings.xml" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/libraries/silvrapi_node_modules.xml" beforeDir="false" />
<change afterPath="$PROJECT_DIR$/server/routes/geocode.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/silvrapi.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/silvrapi.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/app.js" beforeDir="false" afterPath="$PROJECT_DIR$/app.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/newapp.js" beforeDir="false" afterPath="$PROJECT_DIR$/apiserver.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/node_modules/body-parser/HISTORY.md" beforeDir="false" afterPath="$PROJECT_DIR$/node_modules/body-parser/HISTORY.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/node_modules/body-parser/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/node_modules/body-parser/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/node_modules/body-parser/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/node_modules/body-parser/index.js" afterDir="false" />
@ -557,6 +557,12 @@
<change beforePath="$PROJECT_DIR$/node_modules/serve-favicon/node_modules/parseurl/index.js" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/node_modules/serve-favicon/node_modules/parseurl/package.json" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/node_modules/serve-favicon/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/node_modules/serve-favicon/package.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/package.json" beforeDir="false" afterPath="$PROJECT_DIR$/package.json" afterDir="false" />
<change beforePath="$PROJECT_DIR$/routes/btc.js" beforeDir="false" afterPath="$PROJECT_DIR$/server/routes/btc.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/routes/temp.js" beforeDir="false" afterPath="$PROJECT_DIR$/server/routes/temp.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/routes/time.js" beforeDir="false" afterPath="$PROJECT_DIR$/server/routes/time.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/routes/trains.js" beforeDir="false" afterPath="$PROJECT_DIR$/server/routes/trains.js" afterDir="false" />
<change beforePath="$PROJECT_DIR$/routes/weight.js" beforeDir="false" afterPath="$PROJECT_DIR$/routes/weight.js" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -573,8 +579,8 @@
<option name="RECENT_TEMPLATES">
<list>
<option value="EJS" />
<option value="JavaScript File" />
<option value="CSS File" />
<option value="JavaScript File" />
</list>
</option>
</component>
@ -647,15 +653,23 @@
<property name="js-jscs-nodeInterpreter" value="/usr/local/bin/node" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/../rinser" />
<property name="list.type.of.created.stylesheet" value="CSS" />
<property name="node.js.detected.package.eslint" value="true" />
<property name="node.js.detected.package.standard" value="true" />
<property name="node.js.path.for.package.eslint" value="project" />
<property name="node.js.path.for.package.standard" value="project" />
<property name="node.js.path.for.package.tslint" value="project" />
<property name="node.js.selected.package.eslint" value="(autodetect)" />
<property name="node.js.selected.package.standard" value="" />
<property name="node.js.selected.package.tslint" value="(autodetect)" />
<property name="nodejs_interpreter_path" value="node" />
<property name="nodejs_package_manager_path" value="npm" />
<property name="restartRequiresConfirmation" value="false" />
<property name="settings.editor.selected.configurable" value="JavaScript.Libraries" />
<property name="settings.editor.splitter.proportion" value="0.2" />
<property name="settings.editor.selected.configurable" value="editor.preferences.completion" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/server/routes" />
</key>
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/public/lib" />
</key>
@ -667,7 +681,7 @@
<configuration default="true" type="DartTestRunConfigurationType" factoryName="Dart Test">
<method />
</configuration>
<configuration name="newapp" type="NodeJSConfigurationType" path-to-node="$USER_HOME$/.nvm/versions/node/v10.16.2/bin/node" path-to-js-file="newapp.js" working-dir="$PROJECT_DIR$">
<configuration name="newapp" type="NodeJSConfigurationType" path-to-node="$USER_HOME$/.nvm/versions/node/v10.16.2/bin/node" path-to-js-file="$PROJECT_DIR$/apiserver.js" working-dir="$PROJECT_DIR$">
<envs>
<env name="DB_HOME" value="$USER_HOME$" />
</envs>
@ -709,14 +723,9 @@
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1447021065296</updated>
<workItem from="1580742040516" duration="1072000" />
</task>
<task id="LOCAL-00007" summary="trying to persist the db again">
<created>1447077123179</created>
<option name="number" value="00007" />
<option name="presentableId" value="LOCAL-00007" />
<option name="project" value="LOCAL" />
<updated>1447077123179</updated>
<workItem from="1580742040516" duration="2575000" />
<workItem from="1580772170349" duration="2954000" />
<workItem from="1581512872729" duration="33000" />
</task>
<task id="LOCAL-00008" summary="trying to persist the db again">
<created>1447756672584</created>
@ -1054,7 +1063,14 @@
<option name="project" value="LOCAL" />
<updated>1455711342213</updated>
</task>
<option name="localTasksCounter" value="56" />
<task id="LOCAL-00056" summary="websocket stuff">
<created>1580743625695</created>
<option name="number" value="00056" />
<option name="presentableId" value="LOCAL-00056" />
<option name="project" value="LOCAL" />
<updated>1580743625695</updated>
</task>
<option name="localTasksCounter" value="57" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -1065,7 +1081,9 @@
<map>
<entry key="MAIN">
<value>
<State />
<State>
<option name="COLUMN_ORDER" />
</State>
</value>
</entry>
</map>
@ -1101,43 +1119,50 @@
<option name="LAST_COMMIT_MESSAGE" value="websocket stuff" />
</component>
<component name="WindowStateProjectService">
<state x="2621" y="251" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1580742065211">
<state x="2800" y="254" key="#Usage_Scope" timestamp="1580744275276">
<screen x="2048" y="23" width="2048" height="1129" />
</state>
<state x="2800" y="254" key="#Usage_Scope/0.23.2048.1129/2048.23.2048.1129@2048.23.2048.1129" timestamp="1580744275276" />
<state x="573" y="251" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1580772438478">
<screen x="0" y="23" width="2048" height="1129" />
</state>
<state x="573" y="251" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.23.2048.1129/2048.23.2048.1129@0.23.2048.1129" timestamp="1580772438478" />
<state x="2621" y="251" key="#com.intellij.execution.impl.EditConfigurationsDialog/0.23.2048.1129/2048.23.2048.1129@2048.23.2048.1129" timestamp="1580742065211" />
<state width="829" height="207" key="GridCell.Tab.0.bottom" timestamp="1580741348535">
<state x="2938" y="375" key="#com.intellij.ide.scriptingContext.ui.PerFileMappingsDialogWrapper" timestamp="1580744307356">
<screen x="2048" y="23" width="2048" height="1129" />
</state>
<state x="2938" y="375" key="#com.intellij.ide.scriptingContext.ui.PerFileMappingsDialogWrapper/0.23.2048.1129/2048.23.2048.1129@2048.23.2048.1129" timestamp="1580744307356" />
<state x="2847" y="169" key="CommitChangelistDialog2" timestamp="1580743625177">
<screen x="2048" y="23" width="2048" height="1129" />
</state>
<state x="2847" y="169" key="CommitChangelistDialog2/0.23.2048.1129/2048.23.2048.1129@2048.23.2048.1129" timestamp="1580743625177" />
<state width="1705" height="306" key="GridCell.Tab.0.bottom" timestamp="1580775543132">
<screen x="0" y="23" width="2048" height="1129" />
</state>
<state width="829" height="207" key="GridCell.Tab.0.bottom/0.23.2048.1129/2048.23.2048.1129@0.23.2048.1129" timestamp="1580741348535" />
<state width="829" height="207" key="GridCell.Tab.0.center" timestamp="1580741348534">
<state width="1705" height="306" key="GridCell.Tab.0.bottom/0.23.2048.1129/2048.23.2048.1129@0.23.2048.1129" timestamp="1580775543132" />
<state width="1705" height="306" key="GridCell.Tab.0.center" timestamp="1580775543131">
<screen x="0" y="23" width="2048" height="1129" />
</state>
<state width="829" height="207" key="GridCell.Tab.0.center/0.23.2048.1129/2048.23.2048.1129@0.23.2048.1129" timestamp="1580741348534" />
<state width="829" height="207" key="GridCell.Tab.0.left" timestamp="1580741348533">
<state width="1705" height="306" key="GridCell.Tab.0.center/0.23.2048.1129/2048.23.2048.1129@0.23.2048.1129" timestamp="1580775543131" />
<state width="1705" height="306" key="GridCell.Tab.0.left" timestamp="1580775543131">
<screen x="0" y="23" width="2048" height="1129" />
</state>
<state width="829" height="207" key="GridCell.Tab.0.left/0.23.2048.1129/2048.23.2048.1129@0.23.2048.1129" timestamp="1580741348533" />
<state width="829" height="207" key="GridCell.Tab.0.right" timestamp="1580741348534">
<state width="1705" height="306" key="GridCell.Tab.0.left/0.23.2048.1129/2048.23.2048.1129@0.23.2048.1129" timestamp="1580775543131" />
<state width="1705" height="306" key="GridCell.Tab.0.right" timestamp="1580775543131">
<screen x="0" y="23" width="2048" height="1129" />
</state>
<state width="829" height="207" key="GridCell.Tab.0.right/0.23.2048.1129/2048.23.2048.1129@0.23.2048.1129" timestamp="1580741348534" />
<state width="1705" height="306" key="GridCell.Tab.0.right/0.23.2048.1129/2048.23.2048.1129@0.23.2048.1129" timestamp="1580775543131" />
<state x="2717" y="226" key="SettingsEditor" timestamp="1580744316951">
<screen x="2048" y="23" width="2048" height="1129" />
</state>
<state x="2717" y="226" key="SettingsEditor/0.23.2048.1129/2048.23.2048.1129@2048.23.2048.1129" timestamp="1580744316951" />
<state x="3047" y="512" key="VCS.EditChangelistDialog" timestamp="1580742321561">
<screen x="2048" y="23" width="2048" height="1129" />
</state>
<state x="3047" y="512" key="VCS.EditChangelistDialog/0.23.2048.1129/2048.23.2048.1129@2048.23.2048.1129" timestamp="1580742321561" />
<state x="2756" y="329" key="Vcs.Push.Dialog.v2" timestamp="1580742249539">
<state x="2756" y="329" key="Vcs.Push.Dialog.v2" timestamp="1580743628919">
<screen x="2048" y="23" width="2048" height="1129" />
</state>
<state x="2756" y="329" key="Vcs.Push.Dialog.v2/0.23.2048.1129/2048.23.2048.1129@2048.23.2048.1129" timestamp="1580742249539" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="javascript">
<url>file://$PROJECT_DIR$/routes/weight.js</url>
<line>3</line>
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
<state x="2756" y="329" key="Vcs.Push.Dialog.v2/0.23.2048.1129/2048.23.2048.1129@2048.23.2048.1129" timestamp="1580743628919" />
</component>
</project>

View File

@ -1,6 +1,9 @@
require('dotenv').config();
const express = require('express');
const basicAuth = require('express-basic-auth');
const helmet = require('helmet');
const path = require('path');
const http = require('http');
const favicon = require('serve-favicon');
@ -9,11 +12,12 @@ const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const routes = require('./routes/index');
const users = require('./routes/users');
const timeroute = require('./routes/time');
const btcroute = require('./routes/btc');
const temproute = require('./routes/temp');
const timeroute = require('./server/routes/time');
const btcroute = require('./server/routes/btc');
const temproute = require('./server/routes/temp');
const weightroute = require('./routes/weight');
const weatherRoute = require('./server/routes/weather');
const geocodeRoute = require('./server/routes/geocode');
const app = express();
GLOBAL.lastcheck = { 'btc': 0, 'fx': 0 };
@ -22,6 +26,18 @@ app.set('port', process.env.PORT || 8030);
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'ejs');
app.use(logger('dev'));
app.use(basicAuth({
'users': {
'testmvc': '9E#!7!Nu5kd$FnCBQj_=Bh6WgGPqG@g-ETK%y3Ht+87rRT!Vvp=DH=6&w7mJ*36!',
'jubilee' : '_TX2LD6n8csqE=TcPNR#h&4b%Mh_YdDNbe@vwAwhY^7=?AAL@U^SF2rwHxRQt4#M',
'simpleweather' : 'stq^J4rZ%c=F+2ym^GRxB*^+5?XC!#Xjv6n6?Sb9kP4y@26puAt@*n8zvSqG$#dW',
'weatherapp' : '!t@M6f+Wz#-3BpWVC5GLMrb7DrdhenXCxKDkL%g2!CPsRx4#&GFz$BUPvgPn?Z=A'
}
}));
app.use(helmet());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ 'extended': true }));
app.use(cookieParser());
@ -35,6 +51,7 @@ app.use('/btc', btcroute);
app.use('/temp', temproute);
app.use('/weight', weightroute);
app.use('/weather', weatherRoute);
app.use('/geocode', geocodeRoute);
// Handle 404
app.use((req, res) => {

6
app.js
View File

@ -11,9 +11,9 @@ var bodyParser = require('body-parser');
var routes = require('./routes/index');
var users = require('./routes/users');
var timeroute = require('./routes/time');
var btcroute = require('./routes/btc');
var temproute = require('./routes/temp');
var timeroute = require('./server/routes/time');
var btcroute = require('./server/routes/btc');
var temproute = require('./server/routes/temp');
var weightroute = require('./routes/weight');
var app = express();

View File

@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
"start": "node apiserver.js"
},
"dependencies": {
"body-parser": "^1.19.0",
@ -14,8 +14,10 @@
"eslint": "^6.8.0",
"events": "^3.0.0",
"express": "^4.17.1",
"express-basic-auth": "^1.2.0",
"express-promise-router": "^3.0.3",
"fecha": "^4.0.0",
"helmet": "^3.21.2",
"lodash": "^4.17.15",
"morgan": "^1.9.1",
"node-geocoder": "^3.25.0",

View File

@ -1,54 +0,0 @@
var express = require('express'), http = require('http');
var router = express.Router();
var btcCache = {};
/* GET users listing. */
router.get('/', function(req, res, next) {
console.log('Bitcoin request');
function btcQuery(callback, r) {
var req = r;
var options = {
host: 'api.coindesk.com',
// port: 80,
path: '/v1/bpi/currentprice.json',
// method: 'GET',
headers: {
/* 'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(data)*/
}
};
http.request(options).on('response', function (response) {
var data = '';
response.on("data", function (chunk) {
data += chunk;
});
response.on('end', function () {
callback(JSON.parse(data), r);
});
}).end();
}
var now = new Date();
if (now - GLOBAL.lastcheck.btc > (59000 )) {
btcQuery(function (a, b) {
console.log(a);
btcCache = a;
GLOBAL.lastcheck.btc = now;
res.writeHead(200, {"ContentType": "application/json"});
//res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(btcCache));
}, res)
}
else {
console.log("Using cache");
//res.setHeader('Content-Type', 'application/json');
res.writeHead(200, {"ContentType": "application/json"});
res.end(JSON.stringify(btcCache));
}
});
module.exports = router;

View File

@ -1,8 +1,10 @@
var express = require('express'), fs = require('fs'), sqlite3 = require('sqlite3').verbose();
var router = express.Router();
const express = require('express');
const fs = require('fs');
const sqlite3 = require('sqlite3').verbose();
const router = express.Router();
var weight_db;
var file = process.env.DB_HOME + '/' + "weight.db";
let weight_db;
const file = `${process.env.DB_HOME}/` + 'weight.db';
/* GET users listing. */
@ -12,19 +14,16 @@ function createWeightDB() {
console.log(file);
if (!fs.existsSync(file)) {
console.log('creating db file');
fs.openSync(file,'w');
fs.openSync(file, 'w');
weight_db = new sqlite3.Database(file, createWeightTable);
weight_db.close();
}
}
function connectWeightDB() {
"use strict";
'use strict';
console.log('Connect db.');
weight_db = new sqlite3.Database(file);
}
@ -34,81 +33,68 @@ function createWeightTable() {
weight_db.run('CREATE TABLE IF NOT EXISTS weight (date text, reading real);');
}
function closeWeightDB() {
"use strict";
'use strict';
console.log('Closing db.');
weight_db.close();
}
function insertWeightReading(time, reading) {
console.log('Inserting reading:' + reading);
console.log(`Inserting reading:${ reading}`);
// var sql = db.prepare('INSERT into temperature(date, reading) VALUES
// var sql = db.prepare('INSERT into temperature(date, reading) VALUES
// (?,?)',[time],[reading]);
weight_db.run('BEGIN TRANSACTION');
weight_db.run('INSERT into weight(date, reading) VALUES (?,?)',[time, reading]);
weight_db.run('INSERT into weight(date, reading) VALUES (?,?)', [time, reading]);
weight_db.run('END');
}
router.get('/', function(req, res, next) {
var now = new Date();
const now = new Date();
var t = req.query;
const t = req.query;
if (req.query != {} && req.query.weight != null)
{
// createDB();
if (req.query != {} && req.query.weight != null) {
// createDB();
console.log(req.query);
connectWeightDB();
insertWeightReading(now.toJSON(),parseFloat(req.query.weight) );
insertWeightReading(now.toJSON(), parseFloat(req.query.weight) );
closeWeightDB();
res.writeHead(200, {"ContentType": "application/json"});
//res.send(JSON.stringify(t));
res.writeHead(200, { 'ContentType': 'application/json' });
// res.send(JSON.stringify(t));
res.end(JSON.stringify(t));
} else
{
res.render('weight', { });
}
}
else
res.render('weight', { });
});
router.get('/all', function(req, res, next) {
"use strict";
'use strict';
console.log('Selecint all..');
connectWeightDB();
weight_db.all('SELECT * from weight', function(err, rows) {
var out = [];
console.log(err);
console.log(rows);
rows.forEach(function (row) {
console.log(row.date + ', ' + row.reading);
// var t = ;
// out.push({"date": Date(row.date), "reading":row.reading});
out.push({"date": row.date, "reading":row.reading});
});
res.writeHead(200, {"ContentType": "application/json"});
//res.send(JSON.stringify(t));
res.end(JSON.stringify(out));
closeWeightDB();
weight_db.all('SELECT * from weight', function(err, rows) {
const out = [];
console.log(err);
console.log(rows);
rows.forEach(function (row) {
console.log(`${row.date }, ${ row.reading}`);
// var t = ;
// out.push({"date": Date(row.date), "reading":row.reading});
out.push({ 'date': row.date, 'reading':row.reading });
});
res.writeHead(200, { 'ContentType': 'application/json' });
// res.send(JSON.stringify(t));
res.end(JSON.stringify(out));
closeWeightDB();
});
});
module.exports = router;

51
server/routes/btc.js Normal file
View File

@ -0,0 +1,51 @@
const express = require('express'), http = require('http');
const router = express.Router();
let btcCache = {};
/* GET users listing. */
router.get('/', function(req, res, next) {
console.log('Bitcoin request');
function btcQuery(callback, r) {
const req = r;
const options = {
'host': 'api.coindesk.com', // port: 80,
'path': '/v1/bpi/currentprice.json', // method: 'GET',
'headers': {
/* 'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(data)*/
}
};
http.request(options).on('response', function (response) {
let data = '';
response.on('data', function (chunk) {
data += chunk;
});
response.on('end', function () {
callback(JSON.parse(data), r);
});
}).end();
}
const now = new Date();
if (now - GLOBAL.lastcheck.btc > (59000 ))
btcQuery(function (a, b) {
console.log(a);
btcCache = a;
GLOBAL.lastcheck.btc = now;
res.writeHead(200, { 'ContentType': 'application/json' });
// res.setHeader('Content-Type', 'application/json');
res.end(JSON.stringify(btcCache));
}, res);
else {
console.log('Using cache');
// res.setHeader('Content-Type', 'application/json');
res.writeHead(200, { 'ContentType': 'application/json' });
res.end(JSON.stringify(btcCache));
}
});
module.exports = router;

36
server/routes/geocode.js Normal file
View File

@ -0,0 +1,36 @@
var router = require('express-promise-router')();
const geocode = require('../lib/geocode');
const logger = require('log4js').getLogger('geocode');
logger.level = 'debug';
const standardError = {
'error':'There was an error'
};
router.get('/', async (req, res, next) => {
if (req.query.hasOwnProperty('ll')) {
const ll = req.query.ll;
console.log('ll', ll);
geocode.doGetGeocode(ll)
.then((d) => {
res.set('Cache-Control', 'public, max-age=900');
res.send(d);
}).catch((e) => {
logger.error(e);
res.status(500).send(Object.assign(standardError, { 'source':'geocode', 'e':e }));
});
}
else {
// throw new Error('Weather: LL missing');
logger.warn('FS: LL missing');
res.status(500).send('LL Missing');
}
});
module.exports = router;

View File

@ -132,7 +132,7 @@ createDB();
var doInsertEvent = (obj) => {
// logger.info('sendSocket: ' + JSON.stringify(obj));
insertTempReading(obj.time, obj.value);
}
};
busEmitter.on('saveTempData', doInsertEvent);
@ -181,7 +181,7 @@ wsServer.on('request', function (request) {
{
logger.info('sendSocket: ' + JSON.stringify(obj));
connection.sendUTF(JSON.stringify(obj));
}
};
busEmitter.on('sendSocket', sendSocketHandler);
connection.on('message', function (message) {
@ -200,5 +200,5 @@ wsServer.on('request', function (request) {
logger.debug((new Date()) + ' Peer ' + connection.remoteAddress + ' disconnected.');
busEmitter.removeListener('sendSocket', sendSocketHandler);
});
});;
});