Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #153 - handle nats connections that are already connected #154

Merged
merged 2 commits into from
Jan 24, 2020

Conversation

aricart
Copy link
Member

@aricart aricart commented Jan 24, 2020

stan.js connections initialize the stan protocol on the nats connect event. In cases where the connection is provided, and already connected, this event is never emitted, thus the client hangs.

…of a nats connection that is already connected.

In that case the handlers will need to be added as they are, but the protocol initialization will have to be triggered by the library.
@aricart aricart requested a review from kozlovic January 24, 2020 15:44
Copy link
Member

@kozlovic kozlovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I would have put one of the condition in setupHandlers in createConnection, but that's just my preference.


// @private
Stan.prototype.setupHandlers = function () {
// if they gave us a connection, it could be connected, so the `connect` event may never fire.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have done that in createConnection() since we already check if the connection is owned or not.

@aricart aricart merged commit c7a288c into master Jan 24, 2020
@aricart aricart deleted the fix-153 branch January 24, 2020 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants