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

[Bug] Unable to create multiple connections. #68

Open
ramhr opened this issue Feb 26, 2024 · 0 comments
Open

[Bug] Unable to create multiple connections. #68

ramhr opened this issue Feb 26, 2024 · 0 comments

Comments

@ramhr
Copy link
Contributor

ramhr commented Feb 26, 2024

When calling arnavmq multiple times to create multiple connections to different servers, it does not actually create a new connection each time. Instead, it just replaces the configuration of the old connection.

When calling the arnavmq lib it does:

return require('./modules/arnavmq')(connection(configuration));

While the connection function just returns the same singleton with updated configuration:

let instance;
module.exports = (config) => {
assert(instance || config, 'Connection can not be created because config does not exist');
assert(config.hostname);
if (!instance) {
instance = new Connection(config);
} else {
instance.config = config;
}
return instance;
};

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

No branches or pull requests

1 participant