Socket library suggestions for callbacks

Hi there, I’d like to suggest some changes to the sockets library

  1. It would be great to implement callbacks into python when certain low-level events happen.

    • Connection is established
    • Data is received (the low-level driver knows everything that’s received already since it arrives in packets so you can provide the whole payload to the callback (or at least a significant piece to start) instead of having to read it yourself, figuring out when to stop reading, and then starting the application processing of the data received.
    • Data was sent (so you can send another chunk when the payload doesn’t fit in a single packet)
  2. Implement (again with callbacks) network events signaling

    • Connection is lost/dropped
    • Network is lost/reconnected

This would, IMHO, simplify code and significantly improve readability of the code, making it more atomic and asynchronous

Thanks in advance
Best regards

Thanks for the suggestions, I’ll pass them to the dev team to see if they’re feasible.