Add property & setter: Client.create_socket - #945
Conversation
Add property & setter: Client.create_socket Update client.py Update client.py
|
The issue I see with adding API to simply replacing
So we need to carefully pick the API we use. I believe we shouldn't replace the full
But maybe the right level would be to be a "proxy" level:
This way most feature of I think think to a Does this sound good to you ? |
|
Thanks for your thoughts, Pierre. I fully understand where you're coming from - _create_socket can call to three sub methods (and _WebsocketWrapper), giving 6 possible combinations (unix, tcp & websockets, all three both with and without ssl). Plus possibly handling a proxy. But, as far as I can tell (please correct me if I'm wrong), that method is essentially a factory that returns one of 10 possible combinations. None of those methods alter the client's state. Given a few extra args for the client's attrs, they could all be refactored into functions that return some socket (I'm not suggesting this). My idea is, that instead of in future adding even more config and custom logic, to implement an 11th, a 12th, or even a 20th socket, lets just let those users that want those sockets, create them and supply them themselves. All they need to do it implement the SocketLike. I completely agree that any "user provided version must implement all of this". The intended user base for this feature would be required to handle all that for themselves, whilst creating their custom socket. And LibraryRaven for one, is telling us that they're not only willing to do so, they have already done this. And perhaps other third party libraries, as well as Paramiko even provide socket instances out of the box already, that with a few tweaks, Paho.mqtt.Python should happily work with. I'll bow to your experience though, if you think officially supporting this would create even more issues and headaches from such power users in future. |
Implements #873
I'm raising this as a draft PR now to gather feedback. I'll add tests in due course.