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

Open a connection in RelpConnection when sending messages #68

Open
51-code opened this issue Aug 28, 2024 · 1 comment
Open

Open a connection in RelpConnection when sending messages #68

51-code opened this issue Aug 28, 2024 · 1 comment
Labels
feature Existing feature

Comments

@51-code
Copy link

51-code commented Aug 28, 2024

Description

Currently opening a connection is handled in the connect() function. This could be refactored so that no explicit call to this function is needed. The commit() function would make sure that a connection is opened before the message is sent.

This would simplify using the object in other components. Now in some cases the connection has to be done in the constructor, which is bad design, but there really is no better alternative.

@51-code
Copy link
Author

51-code commented Aug 29, 2024

RelpConnection would also benefit from refactoring it to be immutable. Currently the status of the connection is kept inside a variable, it should return a new RelpConnection with the updated state instead. An interface for the object would also help with unit testing in other components, where fake objects are needed.

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

No branches or pull requests

1 participant