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

Use ConnectionFactory instead of creating socket inside the Connection class constructor #12

Open
hkulekci opened this issue Jan 11, 2023 · 0 comments

Comments

@hkulekci
Copy link
Owner

https://www.reddit.com/r/PHP/comments/107ehex/comment/j3r2ksv/

Newing socket factory in the Connection constructor only to create a socket client and throw the socket factory away hints that there should be a ConnectionFactory instead. It should accept socket factory in constructor. And offer a createConnection method that would call createClient on the socket factory and pass the returned socket client instance to constructor of Connection and then return the connection instance.

The callback parameter of Connection constructor is also weird. Why don't you just call the callback code after obtaining the new Connection instance?

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

No branches or pull requests

1 participant