Optimized subscriptions
This commit is contained in:
@@ -16,8 +16,6 @@ standard-minifiers # JS/CSS minifiers run for production mode
|
||||
es5-shim # ECMAScript 5 compatibility for older browsers.
|
||||
ecmascript # Enable ECMAScript2015+ syntax in app code
|
||||
|
||||
autopublish # Publish all data to the clients (for prototyping)
|
||||
insecure # Allow all DB writes from clients (for prototyping)
|
||||
less
|
||||
huttonr:bootstrap3
|
||||
nimble:restivus
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
accounts-base@1.2.2
|
||||
accounts-password@1.1.4
|
||||
amplify@1.0.0
|
||||
autopublish@1.0.4
|
||||
autoupdate@1.2.4
|
||||
babel-compiler@5.8.24_1
|
||||
babel-runtime@0.1.4
|
||||
@@ -38,7 +37,6 @@ http@1.1.1
|
||||
huttonr:bootstrap3@3.3.6_6
|
||||
huttonr:bootstrap3-assets@3.3.6_2
|
||||
id-map@1.0.4
|
||||
insecure@1.0.4
|
||||
jquery@1.11.4
|
||||
json@1.0.3
|
||||
launch-screen@1.0.4
|
||||
|
||||
@@ -9,5 +9,5 @@
|
||||
|
||||
|
||||
#bucket_image {
|
||||
width: 30%;
|
||||
width: 60%;
|
||||
}
|
||||
|
||||
8
app/client/startup.js
Normal file
8
app/client/startup.js
Normal file
@@ -0,0 +1,8 @@
|
||||
Tracker.autorun(function () {
|
||||
var id = Session.get('controller_id');
|
||||
if (id) {
|
||||
Meteor.subscribe("sensor_data", id);
|
||||
var hamo = Meteor.subscribe("controller_state", id);
|
||||
console.log(hamo);
|
||||
}
|
||||
});
|
||||
@@ -1,12 +1,7 @@
|
||||
function controller_state() {
|
||||
var controller = Session.get('controller_id');
|
||||
var result = {}
|
||||
if (controller) {
|
||||
result = ControllerState.findOne({
|
||||
controller_id: controller
|
||||
});
|
||||
}
|
||||
|
||||
var controllerId = Session.get('controller_id');
|
||||
result = ControllerState.findOne({});
|
||||
console.log("jupiii", result);
|
||||
if (!result) {
|
||||
result = {}
|
||||
};
|
||||
|
||||
18
app/server/publications.js
Normal file
18
app/server/publications.js
Normal file
@@ -0,0 +1,18 @@
|
||||
// This code only runs on the server
|
||||
Meteor.publish("sensor_data", function(controllerId) {
|
||||
return SensorData.find({
|
||||
controllerId: controllerId
|
||||
}, {
|
||||
sort: {
|
||||
created_at: -1
|
||||
},
|
||||
limit: 100
|
||||
});
|
||||
});
|
||||
|
||||
// This code only runs on the server
|
||||
Meteor.publish("controller_state", function(controllerId) {
|
||||
return ControllerState.find({
|
||||
controller_id: controllerId
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user