API is unclear #8

Open
nickdaugherty opened this Issue Mar 30, 2013 · 3 comments

Comments

Projects
None yet
2 participants

From the documentation, it's difficult to determine exactly how to use this plugin.

The docs mention passing the stream to reconnect(), but also passing opts and onConnect - how is it actually used?

A more intuitive and standard API would be:

reconnect(stream, options);
Owner

dominictarr commented Mar 31, 2013

Thanks for posting a documentation issue!

reconnent needs know how to create a new connection if the current connection ends,

so the api is

reconnect(function (stream) {
  //your code here
}, options)

reconnect(stream, options), wouldn't work, because reconnect wouldn't know what sort of stream you have.

what sort of connection are you trying to reconnect?

Makes sense...so is reconnect (opts, onConnect) (from the docs) a valid function signature, or is that backwards?

Owner

dominictarr commented Apr 4, 2013

oh, right - I gave the options in the other order in my example there - that should have been the other way around,
or you can leave options out and get the defaults (which is what I normally do)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment