Skip to content
This repository has been archived by the owner on Nov 12, 2019. It is now read-only.

API is unclear #8

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

API is unclear #8

nickdaugherty opened this issue Mar 30, 2013 · 3 comments

Comments

@nickdaugherty
Copy link

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);
@dominictarr
Copy link
Owner

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?

@nickdaugherty
Copy link
Author

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

@dominictarr
Copy link
Owner

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants