Base solution for your next web application
Open Closed

Signlar autoconnect issues #11052


User avatar
0
SRTMDEV created

Hello Team,

We're using asp.net core and angular project of the zero. When user login in to the application i got below error realted to the "abp.singlar.autoConnect" in my console.

Below, I have attached screenshot realted to the error.

Thaks, SG


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @SRTMDEV

    It seems like this code block is updated on AspNet Zero. Could you share your app.component.ts ?

  • User Avatar
    0
    SRTMDEV created

    Yes sure, Here is my file

    ` import { Component, Injector, OnInit, ViewChild, AfterViewInit } from '@angular/core'; import { AppConsts } from '@shared/AppConsts'; import { UrlHelper } from '@shared/helpers/UrlHelper'; import { SubscriptionStartType } from '@shared/service-proxies/service-proxies'; import { ChatSignalrService } from 'app/shared/layout/chat/chat-signalr.service'; import { AppComponentBase } from 'shared/common/app-component-base'; import { SignalRHelper } from 'shared/helpers/SignalRHelper'; import { LinkedAccountsModalComponent } from '@app/shared/layout/linked-accounts-modal.component'; import { UserDelegationsModalComponent } from '@app/shared/layout/user-delegations-modal.component'; import { ChangePasswordModalComponent } from '@app/shared/layout/profile/change-password-modal.component'; import { ChangeProfilePictureModalComponent } from '@app/shared/layout/profile/change-profile-picture-modal.component'; import { MySettingsModalComponent } from '@app/shared/layout/profile/my-settings-modal.component'; import { NotificationSettingsModalComponent } from '@app/shared/layout/notifications/notification-settings-modal.component'; import { UserNotificationHelper } from '@app/shared/layout/notifications/UserNotificationHelper'; import { Router, NavigationEnd } from '@angular/router'; import { UrlService } from './shared/url.service'; import { filter } from 'rxjs/operators'; import { DateTimeService } from './shared/common/timing/date-time.service';

    import { ToggleComponent, ScrollTopComponent, DrawerComponent, StickyComponent, MenuComponent, ScrollComponent } from '@metronic/app/kt/components';

    @Component({ templateUrl: './app.component.html', styleUrls: ['./app.component.less'], }) export class AppComponent extends AppComponentBase implements OnInit , AfterViewInit{

    previousUrl: string = null;
    currentUrl: string = null;
    
    subscriptionStartType = SubscriptionStartType;
    theme: string;
    installationMode = true;
    
    @ViewChild('linkedAccountsModal') linkedAccountsModal: LinkedAccountsModalComponent;
    @ViewChild('userDelegationsModal', { static: true }) userDelegationsModal: UserDelegationsModalComponent;
    @ViewChild('changePasswordModal', { static: true }) changePasswordModal: ChangePasswordModalComponent;
    @ViewChild('changeProfilePictureModal', { static: true })
    changeProfilePictureModal: ChangeProfilePictureModalComponent;
    @ViewChild('mySettingsModal', { static: true }) mySettingsModal: MySettingsModalComponent;
    @ViewChild('notificationSettingsModal', { static: true })
    notificationSettingsModal: NotificationSettingsModalComponent;
    @ViewChild('chatBarComponent') chatBarComponent;
    isQuickThemeSelectEnabled: boolean = this.setting.getBoolean('App.UserManagement.IsQuickThemeSelectEnabled');
    IsSessionTimeOutEnabled: boolean =
        this.setting.getBoolean('App.UserManagement.SessionTimeOut.IsEnabled') && this.appSession.userId != null;
    
    public constructor(
        injector: Injector,
        private router: Router,
        private urlService: UrlService,
        private _chatSignalrService: ChatSignalrService,
        private _userNotificationHelper: UserNotificationHelper,
        private _dateTimeService: DateTimeService
    ) {
        super(injector);
    }
    
    ngOnInit(): void {
        this._userNotificationHelper.settingsModal = this.notificationSettingsModal;
        this.theme = abp.setting.get('App.UiManagement.Theme').toLocaleLowerCase();
        this.installationMode = UrlHelper.isInstallUrl(location.href);
    
        this.registerModalOpenEvents();
    
        if (this.appSession.application) {
            SignalRHelper.initSignalR(() => {
                this._chatSignalrService.init();
            });
        }
    
        this.pluginsInitialization();
        
        this.router.events.pipe(
            filter((event) => event instanceof NavigationEnd)
          ).subscribe((event: NavigationEnd) => {
            this.previousUrl = this.currentUrl;
            this.currentUrl = event.url;
            this.urlService.setPreviousUrl(this.previousUrl);
          });
    }
    
    ngAfterViewInit(): void {
            abp.signalr.autoConnect = false;
    }
    
    pluginsInitialization() {
        setTimeout(() => {
          ToggleComponent.bootstrap();
          ScrollTopComponent.bootstrap();
          DrawerComponent.bootstrap();
          StickyComponent.bootstrap();
          MenuComponent.bootstrap();
          ScrollComponent.bootstrap();
    
        }, 200);
      }
    
    subscriptionStatusBarVisible(): boolean {
        return (
            this.appSession.tenantId > 0 &&
            (this.appSession.tenant.isInTrialPeriod || this.subscriptionIsExpiringSoon())
        );
    }
    
    subscriptionIsExpiringSoon(): boolean {
        if (this.appSession.tenant?.subscriptionEndDateUtc) {
            let today = this._dateTimeService.getUTCDate();
            let daysFromNow = this._dateTimeService.plusDays(today, AppConsts.subscriptionExpireNootifyDayCount);
            return daysFromNow >= this.appSession.tenant.subscriptionEndDateUtc;
        }
    
        return false;
    }
    
    registerModalOpenEvents(): void {
        this.subscribeToEvent('app.show.linkedAccountsModal', () => {
            this.linkedAccountsModal.show();
        });
    
        this.subscribeToEvent('app.show.userDelegationsModal', () => {
            this.userDelegationsModal.show();
        });
    
        this.subscribeToEvent('app.show.changePasswordModal', () => {
            this.changePasswordModal.show();
        });
    
        this.subscribeToEvent('app.show.changeProfilePictureModal', () => {
            this.changeProfilePictureModal.show();
        });
    
        this.subscribeToEvent('app.show.mySettingsModal', () => {
            this.mySettingsModal.show();
        }); 
    }
    
    getRecentlyLinkedUsers(): void {
        abp.event.trigger('app.getRecentlyLinkedUsers');
    }
    
    onMySettingsModalSaved(): void {
        abp.event.trigger('app.onMySettingsModalSaved');
    }
    

    } `

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    It seems like this is removed a long time ago. Could you apply changes in this PR to your solution ?

  • User Avatar
    0
    SRTMDEV created

    Hii,

    The given link is not found.