Skip to content

Commit a49336a

Browse files
Staging (#270)
* 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
1 parent 472dba6 commit a49336a

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

api/app/AppFiles.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ module.exports = function() {
1919
res.send();
2020

2121
var fileStream = global.mongoService.document.getFileStreamById(appId, file._id);
22-
2322
res.set('Content-Type', file.contentType);
23+
res.setHeader('Cache-Control', 'public, max-age=86400');
2424
res.set('Content-Disposition', 'attachment; filename="' + file.filename + '"');
2525

2626
fileStream.on("error", function(err) {

database-connect/realTime.js

+16-4
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,13 @@ module.exports = function (io) {
101101
} else { //data has both the room id and the sessionId.
102102
socket.join(data.room);
103103
//connect socket.id and sessionId together
104-
global.socketQueryHelper.setData(socket.id, data.data);
104+
105+
// build socketid specefic to table
106+
var tableSocketId = data.room.split('')
107+
tableSocketId.splice(-8,8)
108+
tableSocketId = socket.id + tableSocketId.join('')
109+
110+
global.socketQueryHelper.setData(tableSocketId, data.data);
105111
global.socketSessionHelper.saveSession(socket.id, data.sessionId);
106112
}
107113
} catch (e) {
@@ -116,13 +122,15 @@ module.exports = function (io) {
116122
try {
117123
console.log('++++++++ Leave Object Realtime Channel+++++');
118124
console.log(data);
119-
global.socketQueryHelper.getData(socket.id, data.eventType, function (err, socketData) {
125+
// build socketid specefic to table
126+
var tableSocketId = socket.id + data.event
127+
global.socketQueryHelper.getData(tableSocketId, data.eventType, function (err, socketData) {
120128
if (err)
121129
throw err;
122130
else {
123131
socket.leave(data.event + socketData.timestamp);
124132
socket.emit('leave' + data.event + data.timestamp, socketData.timestamp); //to removeAlListeners
125-
global.socketQueryHelper.deleteData(socket.id, data.event);
133+
global.socketQueryHelper.deleteData(tableSocketId, data.event);
126134
}
127135
});
128136
} catch (e) {
@@ -212,7 +220,7 @@ function _sendNotification(appId, document, socket, eventType) {
212220

213221
session = session || {}
214222

215-
global.socketQueryHelper.getData(socket.id, eventType, function (err, socketData) {
223+
global.socketQueryHelper.getData(_buildSocketId(socket.id,appId,document._tableName,eventType), eventType, function (err, socketData) {
216224

217225
socketData = socketData || { timestamp: '' };
218226
var socketQueryValidate = true;
@@ -260,3 +268,7 @@ function _sendNotification(appId, document, socket, eventType) {
260268
}
261269
return deferred.promise;
262270
}
271+
272+
function _buildSocketId(socketId, appId,tableName,eventType){
273+
return socketId + (appId + 'table' + tableName + eventType).toLowerCase()
274+
}

0 commit comments

Comments
 (0)