You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IMHO connect() should be the method to "activate" the client, and should be callable just once.
I tend to agree with @ibc here, but I can also understand @braytak's perspective. @braytak - the benefit is simplifying the API. The parameters that can be passed to connect() are a complete mess with multiple optional parameters of various types. Also, since I wasn't specifically planning on having the objects be reusable for multiple connections when I originally wrote the client code, the behavior when doing so is undefined. There may be bugs that arise if the state isn't properly cleaned up or reset before making another connection. Or it may work fine, I don't really know. Since there aren't unit tests in the library for things like this, (something I'd like very much to start adding), it makes me nervous.
Looking back at my original goal of cleaning up the connect() API, what if we change it to accept a single options object parameter, the same format as the constructor. That way, you could set all the options in the constructor if you wanted, and override individual options each time you call connect(). Or don't pass any options to the constructor, and pass them all to connect(). Internally, it would keep the original options from the constructor (or the defaults), and every time connect() was called, a new copy would be created and extended with the newly supplied options.
Thoughts?
The text was updated successfully, but these errors were encountered:
Continuing discussion that started in #158
I tend to agree with @ibc here, but I can also understand @braytak's perspective. @braytak - the benefit is simplifying the API. The parameters that can be passed to
connect()
are a complete mess with multiple optional parameters of various types. Also, since I wasn't specifically planning on having the objects be reusable for multiple connections when I originally wrote the client code, the behavior when doing so is undefined. There may be bugs that arise if the state isn't properly cleaned up or reset before making another connection. Or it may work fine, I don't really know. Since there aren't unit tests in the library for things like this, (something I'd like very much to start adding), it makes me nervous.Looking back at my original goal of cleaning up the
connect()
API, what if we change it to accept a singleoptions
object parameter, the same format as the constructor. That way, you could set all the options in the constructor if you wanted, and override individual options each time you callconnect()
. Or don't pass any options to the constructor, and pass them all toconnect()
. Internally, it would keep the original options from the constructor (or the defaults), and every timeconnect()
was called, a new copy would be created and extended with the newly supplied options.Thoughts?
The text was updated successfully, but these errors were encountered: