Minor refactoring done.
Made a check at start if notificationSocket is connected.