Closed lorenzodonini closed 3 years ago
There's no reason to have different readPump
/writePump
methods for client and server is there? Or put another way, I think the right abstraction might be "connection" and "server", where a server just manages multiple connections.
There's no reason to have different
readPump
/writePump
methods for client and server is there? Or put another way, I think the right abstraction might be "connection" and "server", where a server just manages multiple connections.
There are a few subtle differences between the two, like:
I could definitely abstract this away with a few function parameters, pass a nil channel to the entity that doesn't send the ping and add a couple more conditions, but I'm afraid it won't read as nicely and look as clean. I'm willing to give it a try, if you believe it would be worth it, but in general I'm not against code duplication, when two entities actually behave differently.
I merged this one for now, will tackle your suggestion in a separate MR.
Stop
on the websocket server