You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a problem reading intensity value on my zetta app.
I have two different zetta servers (server1 and server2) running on my local machine.
On server1, it uses zetta-photocell-mock-driver and link to server2.
On server2, it has a zetta app which observes the intensity of photocell driver on server1.
This is my zetta app code on server2:
...
var PhotocellQuery = server.from('server2').where({ type: 'photocell' });
server.observe([PhotocellQuery], function(photocell){
photocell.streams.intensity.on(‘data', function(m){
console.log(m);
});
});
…
This worked fine at the beginning. I was able to read the stream on the intensity continuously whenever there are changes.However, if I open up the zetta browser and close it, I no longer receives the intensity values in my zetta app on server2.
It seems like the zetta browser unsubscribe my topic when it got closed.
I tried to run exactly same code (app) on server1 and it worked fine. I could read the intensity values whenever there are changes. (no matter if I open/close the zetta browser)
The only difference that I noticed from two apps is a type of the callback function when the topic gets subscribed.
In zetta/lib/pubsub_service.js
PubSub.prototype.subscribe = function(topic, callback) {
var f = null;
if (typeof callback === 'function') {
f = this._onCallback(topic, callback);
this.emitter.on(topic, f);
} else if (typeof callback === 'object') {
f = this._onResponse(topic, callback);
this.emitter.on(topic, f);
} else {
…
The type of callback function is ‘function’ when server1 subscribe topic, but the type of callback function is ‘object’ when server2 subscribe topic.
I want to continuously read the intensity values using my zetta app on server2 even after the zetta browser is closed.
Is there anything that I could do? or Is there better way to read the intensity value in my zetta app?
Thanks
The text was updated successfully, but these errors were encountered:
Hi,
I have a problem reading intensity value on my zetta app.
I have two different zetta servers (server1 and server2) running on my local machine.
On server1, it uses zetta-photocell-mock-driver and link to server2.
On server2, it has a zetta app which observes the intensity of photocell driver on server1.
This is my zetta app code on server2:
...
var PhotocellQuery = server.from('server2').where({ type: 'photocell' });
server.observe([PhotocellQuery], function(photocell){
photocell.streams.intensity.on(‘data', function(m){
console.log(m);
});
});
…
This worked fine at the beginning. I was able to read the stream on the intensity continuously whenever there are changes.However, if I open up the zetta browser and close it, I no longer receives the intensity values in my zetta app on server2.
It seems like the zetta browser unsubscribe my topic when it got closed.
I tried to run exactly same code (app) on server1 and it worked fine. I could read the intensity values whenever there are changes. (no matter if I open/close the zetta browser)
The only difference that I noticed from two apps is a type of the callback function when the topic gets subscribed.
In zetta/lib/pubsub_service.js
PubSub.prototype.subscribe = function(topic, callback) {
var f = null;
if (typeof callback === 'function') {
f = this._onCallback(topic, callback);
this.emitter.on(topic, f);
} else if (typeof callback === 'object') {
f = this._onResponse(topic, callback);
this.emitter.on(topic, f);
} else {
…
The type of callback function is ‘function’ when server1 subscribe topic, but the type of callback function is ‘object’ when server2 subscribe topic.
I want to continuously read the intensity values using my zetta app on server2 even after the zetta browser is closed.
Is there anything that I could do? or Is there better way to read the intensity value in my zetta app?
Thanks
The text was updated successfully, but these errors were encountered: