Should there be a ready event?
Hi,
I've been having a problem with this kind of code:
var s = msr.createSpeaker(port);
s.request('test', {}, function(respData){
console.log(respData)
})
the respData comes back as {error:-1} unless I wrap the first request in a timeout of a few milliseconds. It seems like it takes some time for the speaker to get created but, using the documented API, I see no way of catching the moment it does. Am I missing something?
my setup: osx 10.6.6 node v0.6.14
I think that ideally you should be handling that error event to re-try the request.
You are probably right to leave the handling of this to the consumer. I'm experimenting with adding a config object to the global messenger to allow for these reconnection attempts to be more automatic and avoid having recursive timeouts in the main code. I'll post back here if anything elegant comes of it. Cheers!
I had the same problem. I've fixed it, see my pull request https://github.com/weixiyen/messenger.js/pull/6