websocket code refactoring, connection type notification