Commit e2be1195 authored by Javier Garcia Hernandez's avatar Javier Garcia Hernandez
Browse files

events-manager working with updated mongodb, nodejs v6.10.3 and express 4

parent fa9d1abe
......@@ -40,6 +40,7 @@ var controlMessages = require('./controlmessages.js');
var logger = require('./logger.js');
var express = require('express');
var moment = require('moment');
var format = require ('util').format;
var app = express();
if ((config.app.SSL != undefined) && (config.app.SSL == true)){
......@@ -54,8 +55,8 @@ var io = require('socket.io').listen(server, { log: true });
var brokerConnector = new BrokerConnector(config.connectorBroker);
var brokerConnection = brokerConnector.connect();
var MongoClient = require('mongodb').MongoClient,
Server = require('mongodb').Server;
var mongoClient = require('mongodb').MongoClient;
//Server = require('mongodb').Server;
......@@ -64,7 +65,7 @@ options.safe = true;
options.logger = {};
options.logger.doDebug = true;
var mongoClient = new MongoClient(new Server(config.db.host, config.db.port), options);
//var mongoClient = new MongoClient(new Server(config.db.host, config.db.port), options);
var dbAEON = undefined;
var dbLogs = undefined;
......@@ -93,7 +94,9 @@ io.configure("heroku", function () {
]);
});
mongoClient.open(function(err, mongoClient) {
var url = format("mongodb://%s:%s/%s",config.db.host, config.db.port, config.db.db);
mongoClient.connect(url, function(err, mongoClient) {
if (err) {
logger.error(err);
......@@ -182,7 +185,7 @@ brokerConnection.once('ready', function() {
brokerManager.subscribe(channel, function controlSubscription(error, ctag) {
logger.info("Inside subscribe with client ", client.id);
if (error)
if (error)
sendError(error, client);
else {
// ctag could be used to emit trough message-ctag
......@@ -409,6 +412,3 @@ function generateUUID() {
});
return uuid;
};
......@@ -7,12 +7,13 @@
"install": "npm install broker-manager-0.2.1.tgz"
},
"dependencies": {
"express": "3.1.0",
"express": "~4.x",
"express-session": "^1.15.3",
"socket.io": "0.9.16",
"socket.io-client": "0.9.16",
"winston": "0.7.2",
"mongodb": "1.3.11",
"moment": "2.3.1"
"winston": ">=0.7.2",
"moment": ">=2.3.1",
"mongodb": ">=1.4.11"
},
"license": "AGPLv3",
......@@ -24,7 +25,7 @@
"email": "javier.garcia@atos.net"
}],
"engines": {
"node": "0.10.x",
"npm": "1.3.x"
"node": ">=0.10.x",
"npm": ">=1.3.x"
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment