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

Cannot receive any messages #55

Closed
minusplusminus opened this issue Feb 24, 2015 · 19 comments
Closed

Cannot receive any messages #55

minusplusminus opened this issue Feb 24, 2015 · 19 comments

Comments

@minusplusminus
Copy link

Hi,

I've installed your server and tried to receive data on multiple platforms. But I still cannot get any data back. Even on your cloud server. When I use the admin panel I get:

6utils.js:33 Uncaught TypeError: Cannot read property 'Safetify' of undefined

when an app is started.

When I use your Openframeworks addon, I see the functions, but there's no activity

@robotconscience
Copy link
Member

Hm, that error should only occur if you're using the outdated code and the newest version of node.

I just checked and the cloud server is running and working. Can you add some more details about your setup?

  • What platform are you on (windows/mac/linux)?
  • What browser are you running in?
  • Are you running your own cloud server or using sandbox.spacebrew.cc?

Let us know, we'll figure this out!

@minusplusminus
Copy link
Author

It's on mac

I'm using Chrome

I'm using the cloud server yes. I've used the master branch

@robotconscience
Copy link
Member

OK, I'm stumped at the moment but will continue to look. If you're using our cloud server (sandbox.spacebrew.cc), it's definitely up, running, and working at the moment. If you're using your own server, I suspect you need to a) update the version of node you're running and/or update to the newest commit from last weekend.

Keep us poster here, we'll figure it out. I've also seen people getting errors if they're using certain Chrome extensions, so try disabling some of those if you continue to get errors?

@willwnekowicz
Copy link

Maybe this should go unsaid, but, did you connect the publisher and subscriber endpoints?

@robotconscience
Copy link
Member

@minusplusminus Are you still having issues?

@violy
Copy link

violy commented Mar 24, 2015

+1

I’ve the same issue, on osx, both on chrome (41.0) + safari (8.0) + firefox (35.0).
the problem arrives with the public URL (http://spacebrew.github.io/spacebrew/admin/admin.html?server=localhost) and my local URL.

Uncaught TypeError: Cannot read property 'Safetify' of undefined

here is the JS call stack

(anonymous function) (utils.js:33)
(anonymous function) (VM242:18)
(anonymous function) (handlebars-1.0.…beta.6.js:1512)
(anonymous function) (handlebars-1.0.…beta.6.js:1483)
handleConfigMsg (wsevents.js:182)
handleMsg (wsevents.js:69)
ws.onmessage (wsevents.js:39)

@robotconscience
Copy link
Member

Trying to replicate, can't seem to make that happen. Will keep trying to track this down!

@quinkennedy what do you think?

@quinkennedy
Copy link
Member

I'm starting to think it has to do with your client/pub/sub/type names. Stringify gets added to the String prototype, and there is also a global Stringify(s) which calls s.Stringify, so I think what is happening is something is calling Stringify(undefined). @minusplusminus you could try setting a breakpoint in utils.js line 24 and refreshing the page to see where that call is coming from and hopefully identifying the client that is exposing the issue.

@violy
Copy link

violy commented Mar 24, 2015

here is the current problem, val is undefined.

//handlebar helper so we can use Safetify in our handlebar templates
//{{Safetify some.cool.property}}
Handlebars.registerHelper('Safetify', function(val){
  return val.Safetify();
});

I've made a small fix, see my PR #56

Thank you

@quinkennedy
Copy link
Member

Thanks @violy are you testing against the public sandbox or a private server? I am not able to reproduce with this: http://spacebrew.github.io/spacebrew/admin/admin.html?server=sandbox.spacebrew.cc

I appreciate the pull request, and it seems like good "graceful failure" handling. I would also like to find the root cause of the problem and not just fix the symptom, hence why I'm still asking questions. Now I guess whatever client has the name "undefined" would lead us to the root cause.

@violy
Copy link

violy commented Mar 24, 2015

thanks @quinkennedy
I’m testing with a local server.
I’ll try to find what is undefined.

@violy
Copy link

violy commented Mar 24, 2015

when I test with button2 sample, with local server,
remoteAddress's newClient seems to be undefined
see admin/js/wsevents.js file

@quinkennedy
Copy link
Member

ah, so it sounds like something with your and @minusplusminus setup makes the client IP address not populated? I felt like the way we were getting the IP was through a series of assumptions, so it is completely plausible that it is broken now...

The original idea behind using the IP addresses was to limit confusion between who was connected, and to allow for cleaning up of improperly closed connections. Perhaps we should re-evaluate the importance of those goals... @robotconscience ?

@robotconscience
Copy link
Member

@quinkennedy I think that's still important! However, I do know it's an issue between using the earlier version of spacebrew (node v < 10) and the newest in master. Did we end up implementing a version that works with both? @minusplusminus and @violy do you know what version of node you're running and what version of spacebrew?

@violy
Copy link

violy commented Mar 24, 2015

with my config, msg.config.remoteAddress is undefined in

var newClient = {name:msg.config.name, remoteAddress:msg.config.remoteAddress};

the JSON config message don't provide remoteAddress

[{"config":{"name":"button4","description":"This spacebrew client sends and receives boolean messages.","publish":{"messages":[{"name":"buttonPress","type":"boolean","default":"false"}]},"subscribe":{"messages":[{"name":"toggleBackground","type":"boolean"}]},"options":{}}},{"config":{"name":"button6","description":"This spacebrew client sends and receives boolean messages.","publish":{"messages":[{"name":"buttonPress","type":"boolean","default":"false"}]},"subscribe":{"messages":[{"name":"toggleBackground","type":"boolean"}]},"options":{}}}]

is it normal ? I only run my local server with default options, like this node node_server_forever --log

@quinkennedy
Copy link
Member

@robotconscience My impulse would be to not worry about node 0.10. The nodejs repo wiki merely states that even versions are stable & odd versions are unstable. This stackoverflow answer states that "only the latest ... version is supported at any given time"

@violy
Copy link

violy commented Mar 24, 2015

I use node v0.10.30,
and my version of spacebrew is the last, cloned from Github.
I'm beginner with spacebrew, but the project looks cool !

@robotconscience
Copy link
Member

@violy that's it, then!
@quinkennedy it's my bad, I didn't implement a fallback for earlier versions of node. How's this look? I can't test on node 10. now, so LMK if you can?

See this commit for where it goes: 9da5211

var getClientAddress = function(connection){
    try{
        // old node returns an object
        var ret = connection._socket._handle.getpeername();
        if ( ret !== null ){
            return connection._socket._handle.getpeername().address;
        } else {
            // new node applies to an object
            var out = {};
            connection._socket._handle.getpeername(out);
            return out.address; //connection.upgradeReq.headers.host;
        }
    } catch (e){}
    logger.log("info", "[printAllTrustedClients] unable to access remote address");
    return "unknown";
};

@heaversm
Copy link

@robotconscience - just to pick up this thread - I had node v0.10.3 as well and was getting this issue. Upgrading to the latest stable version of node fixed the issue for me.

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

No branches or pull requests

6 participants