small refactoring to make the socket emit more clear