Skip to content

Commit

Permalink
Staging (#270)
Browse files Browse the repository at this point in the history
* Import Data

* Import Data

* Import Data

* Import API Update

* Import API Fix

* Update

* Updates Import API

* Updates Import API

* Updates Import API

* Import API Update

* Update

* Import API Update

* Import API Update

* chaging rolling update to api

* Import API Fix

* Import API Fix

* Import API Test

* Import API Test

* Import API Fix

* Update README.md

* Import Export API (#262)

* Import Export API (#263)

* Import Export API

* Import Export API

* Import API

* fixed realTime for multiple tables on a single client

* added cache-control for app-icon images (#269)

* Update README.md

* added cache-control for app-icon images
  • Loading branch information
shubhamqweasd authored Nov 1, 2017
1 parent 472dba6 commit a49336a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion api/app/AppFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ module.exports = function() {
res.send();

var fileStream = global.mongoService.document.getFileStreamById(appId, file._id);

res.set('Content-Type', file.contentType);
res.setHeader('Cache-Control', 'public, max-age=86400');
res.set('Content-Disposition', 'attachment; filename="' + file.filename + '"');

fileStream.on("error", function(err) {
Expand Down
20 changes: 16 additions & 4 deletions database-connect/realTime.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,13 @@ module.exports = function (io) {
} else { //data has both the room id and the sessionId.
socket.join(data.room);
//connect socket.id and sessionId together
global.socketQueryHelper.setData(socket.id, data.data);

// build socketid specefic to table
var tableSocketId = data.room.split('')
tableSocketId.splice(-8,8)
tableSocketId = socket.id + tableSocketId.join('')

global.socketQueryHelper.setData(tableSocketId, data.data);
global.socketSessionHelper.saveSession(socket.id, data.sessionId);
}
} catch (e) {
Expand All @@ -116,13 +122,15 @@ module.exports = function (io) {
try {
console.log('++++++++ Leave Object Realtime Channel+++++');
console.log(data);
global.socketQueryHelper.getData(socket.id, data.eventType, function (err, socketData) {
// build socketid specefic to table
var tableSocketId = socket.id + data.event
global.socketQueryHelper.getData(tableSocketId, data.eventType, function (err, socketData) {
if (err)
throw err;
else {
socket.leave(data.event + socketData.timestamp);
socket.emit('leave' + data.event + data.timestamp, socketData.timestamp); //to removeAlListeners
global.socketQueryHelper.deleteData(socket.id, data.event);
global.socketQueryHelper.deleteData(tableSocketId, data.event);
}
});
} catch (e) {
Expand Down Expand Up @@ -212,7 +220,7 @@ function _sendNotification(appId, document, socket, eventType) {

session = session || {}

global.socketQueryHelper.getData(socket.id, eventType, function (err, socketData) {
global.socketQueryHelper.getData(_buildSocketId(socket.id,appId,document._tableName,eventType), eventType, function (err, socketData) {

socketData = socketData || { timestamp: '' };
var socketQueryValidate = true;
Expand Down Expand Up @@ -260,3 +268,7 @@ function _sendNotification(appId, document, socket, eventType) {
}
return deferred.promise;
}

function _buildSocketId(socketId, appId,tableName,eventType){
return socketId + (appId + 'table' + tableName + eventType).toLowerCase()
}

0 comments on commit a49336a

Please sign in to comment.