refactoring socket io authorization