Refactored WebSocketSessionManager.cs