Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

problem on reading intensity values in zetta app when zetta browser gets closed #139

Closed
seinjin opened this issue Feb 2, 2015 · 4 comments · Fixed by #141
Closed

problem on reading intensity values in zetta app when zetta browser gets closed #139

seinjin opened this issue Feb 2, 2015 · 4 comments · Fixed by #141

Comments

@seinjin
Copy link

seinjin commented Feb 2, 2015

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

@mdobson
Copy link
Contributor

mdobson commented Feb 2, 2015

Hey Tiggerific

Thanks for filing this. We'll look into this, and get back to you as soon as possible with either a fix or workaround.

-Matt

@seinjin
Copy link
Author

seinjin commented Feb 2, 2015

Thanks. Let me know!

@mdobson
Copy link
Contributor

mdobson commented Feb 6, 2015

Hey Tiggerific watch out for the next release of zetta. This issue will be
fixed in it.

-Matt

--
Matthew Dobson | apigee https://apigee.com/ | m: +1.734.634.5472 |
twitter @mdobs http://twitter.com/mdobs @apigee
https://twitter.com/apigee

On Fri, Feb 6, 2015 at 11:20 AM, Adam Magaluk [email protected]
wrote:

Closed #139 #139 via #141
#141.


Reply to this email directly or view it on GitHub
#139 (comment).

@seinjin
Copy link
Author

seinjin commented Feb 6, 2015

Great! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants