Add method check for socket messages
Refactoring server side
Refactoring clientside structure