Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

API is unclear #8

Open
nickdaugherty opened this Issue · 3 comments

2 participants

@nickdaugherty

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
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

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

@dominictarr
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 join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.