<commit_before>import { Injectable } from '@angular/core';
import { HubConnection, HubConnectionBuilder } from '@aspnet/signalr';
import { Subject } from 'rxjs';
import { Store } from '@ngxs/store';
import { SetConnectionId, SignalRHubConnesso, SignalRHubDisconnesso } from './store/signalR.actions';
import { ShowToastr } from '../../shared/store/actions/toastr/toastr.actions';
import { UpdateRichiesta } from '../../features/home/store/actions/richieste/richieste.actions';
import { SignalRNotification } from './model/signalr-notification.model';
import { SetTimeSync } from '../../shared/store/actions/app/app.actions';
import { SetBoxPersonale } from '../../features/home/store/actions/boxes/box-personale.actions';
import { SetBoxMezzi } from '../../features/home/store/actions/boxes/box-mezzi.actions';
import { SetBoxRichieste } from '../../features/home/store/actions/boxes/box-richieste.actions';
import { environment } from '../../../environments/environment';
import { ToastrType } from '../../shared/enum/toastr';
import { InsertChiamataSuccess } from '../../features/home/store/actions/chiamata/scheda-telefonata.actions';
import {
    InsertChiamataMarker,
    RemoveChiamataMarker,
    UpdateItemChiamataMarker
} from '../../features/home/store/actions/maps/chiamate-markers.actions';
import {
    AddBookMezzoComposizione,
    RemoveBookingMezzoComposizione,
    RemoveBookMezzoComposizione,
    SetListaMezziComposizione,
    UpdateMezzoComposizioneScadenzaByCodiceMezzo
} from '../../features/home/store/actions/composizione-partenza/mezzi-composizione.actions';
import { SetListaSquadreComposizione } from '../../features/home/store/actions/composizione-partenza/squadre-composizione.actions';
import { RemoveBoxPartenzaByMezzoId } from '../../features/home/store/actions/composizione-partenza/box-partenza.actions';
import { InsertRichiestaMarker, UpdateRichiestaMarker } from '../../features/home/store/actions/maps/richieste-markers.actions';
import { ComposizionePartenzaState } from '../../features/home/store/states/composizione-partenza/composizione-partenza.state';
import { Composizione } from '../../shared/enum/composizione.enum';
import { SetListaIdPreAccoppiati, UpdateMezzoPreAccoppiatoComposizione } from '../../features/home/store/actions/composizione-partenza/composizione-veloce.actions';
import { SetMezziInServizio } from 'src/app/features/home/store/actions/mezzi-in-servizio/mezzi-in-servizio.actions';
import { ViewComponentState } from '../../features/home/store/states/view/view.state';
import { GetListeComposizioneAvanzata } from '../../features/home/store/actions/composizione-partenza/composizione-avanzata.actions';
import { IdPreaccoppiati } from '../../features/home/composizione-partenza/interface/id-preaccoppiati-interface';
import { UpdateMezzoMarker } from '../../features/home/store/actions/maps/mezzi-markers.actions';
import {
    InsertSchedeContatto,
    RemoveSchedeContatto,
    SetContatoriSchedeContatto,
    SetListaSchedeContatto,
    UpdateSchedaContatto
} from 'src/app/features/home/store/actions/schede-contatto/schede-contatto.actions';
import { ContatoriSchedeContatto } from '../../shared/interface/contatori-schede-contatto.interface';
import { SchedaContatto } from '../../shared/interface/scheda-contatto.interface';
import { GetUtentiGestione } from '../../features/gestione-utenti/store/actions/gestione-utenti/gestione-utenti.actions';
import { Utente } from '../../shared/model/utente.model';
import { ClearUtente, UpdateUtente } from '../../features/navbar/store/actions/operatore/utente.actions';
import { UtenteState } from '../../features/navbar/store/states/operatore/utente.state';
import { UpdateRuoliUtenteLoggato } from '../../shared/store/actions/ruoli/ruoli.actions';
import { Navigate } from '@ngxs/router-plugin';
import { _isAdministrator } from '../../shared/helper/function';

const HUB_URL = environment.signalRHub;
const SIGNALR_BYPASS = !environment.signalR;

@Injectable({
    providedIn: 'root'
})
export class SignalRService {
    connectionEstablished = new Subject<boolean>();
    private hubNotification: HubConnection;

    constructor(private store: Store) {
    }

    initSubscription(): void {
        this.createSubscriptionConnection();
        this.registerOnSubscriptionEvents();
        this.startSubscriptionConnection();
    }

    checkConnection() {
        return this.connectionEstablished.asObservable();
    }

    private createSubscriptionConnection() {<commit_msg>Fix: aggiunta "baseUrl" a signalR<commit_after>import { Injectable } from '@angular/core';
import { HubConnection, HubConnectionBuilder } from '@aspnet/signalr';
import { Subject } from 'rxjs';
import { Store } from '@ngxs/store';
import { SetConnectionId, SignalRHubConnesso, SignalRHubDisconnesso } from './store/signalR.actions';
import { ShowToastr } from '../../shared/store/actions/toastr/toastr.actions';
import { UpdateRichiesta } from '../../features/home/store/actions/richieste/richieste.actions';
import { SignalRNotification } from './model/signalr-notification.model';
import { SetTimeSync } from '../../shared/store/actions/app/app.actions';
import { SetBoxPersonale } from '../../features/home/store/actions/boxes/box-personale.actions';
import { SetBoxMezzi } from '../../features/home/store/actions/boxes/box-mezzi.actions';
import { SetBoxRichieste } from '../../features/home/store/actions/boxes/box-richieste.actions';
import { environment } from '../../../environments/environment';
import { ToastrType } from '../../shared/enum/toastr';
import { InsertChiamataSuccess } from '../../features/home/store/actions/chiamata/scheda-telefonata.actions';
import {
    InsertChiamataMarker,
    RemoveChiamataMarker,
    UpdateItemChiamataMarker
} from '../../features/home/store/actions/maps/chiamate-markers.actions';
import {
    AddBookMezzoComposizione,
    RemoveBookingMezzoComposizione,
    RemoveBookMezzoComposizione,
    SetListaMezziComposizione,
    UpdateMezzoComposizioneScadenzaByCodiceMezzo
} from '../../features/home/store/actions/composizione-partenza/mezzi-composizione.actions';
import { RemoveBoxPartenzaByMezzoId } from '../../features/home/store/actions/composizione-partenza/box-partenza.actions';
import { InsertRichiestaMarker, UpdateRichiestaMarker } from '../../features/home/store/actions/maps/richieste-markers.actions';
import { ComposizionePartenzaState } from '../../features/home/store/states/composizione-partenza/composizione-partenza.state';
import { Composizione } from '../../shared/enum/composizione.enum';
import { SetListaIdPreAccoppiati, UpdateMezzoPreAccoppiatoComposizione } from '../../features/home/store/actions/composizione-partenza/composizione-veloce.actions';
import { SetMezziInServizio } from 'src/app/features/home/store/actions/mezzi-in-servizio/mezzi-in-servizio.actions';
import { ViewComponentState } from '../../features/home/store/states/view/view.state';
import { IdPreaccoppiati } from '../../features/home/composizione-partenza/interface/id-preaccoppiati-interface';
import { UpdateMezzoMarker } from '../../features/home/store/actions/maps/mezzi-markers.actions';
import {
    InsertSchedeContatto,
    RemoveSchedeContatto,
    SetContatoriSchedeContatto,
    SetListaSchedeContatto,
    UpdateSchedaContatto
} from 'src/app/features/home/store/actions/schede-contatto/schede-contatto.actions';
import { ContatoriSchedeContatto } from '../../shared/interface/contatori-schede-contatto.interface';
import { SchedaContatto } from '../../shared/interface/scheda-contatto.interface';
import { GetUtentiGestione } from '../../features/gestione-utenti/store/actions/gestione-utenti/gestione-utenti.actions';
import { Utente } from '../../shared/model/utente.model';
import { ClearUtente, UpdateUtente } from '../../features/navbar/store/actions/operatore/utente.actions';
import { UtenteState } from '../../features/navbar/store/states/operatore/utente.state';
import { UpdateRuoliUtenteLoggato } from '../../shared/store/actions/ruoli/ruoli.actions';
import { Navigate } from '@ngxs/router-plugin';
import { _isAdministrator } from '../../shared/helper/function';

const HUB_URL = environment.baseUrl + environment.signalRHub;
const SIGNALR_BYPASS = !environment.signalR;

@Injectable({
    providedIn: 'root'
})
export class SignalRService {
    connectionEstablished = new Subject<boolean>();
    private hubNotification: HubConnection;

    constructor(private store: Store) {
    }

    initSubscription(): void {
        this.createSubscriptionConnection();
        this.registerOnSubscriptionEvents();
        this.startSubscriptionConnection();
    }

    checkConnection() {
        return this.connectionEstablished.asObservable();
    }

    private createSubscriptionConnection() {
{'fraction_non_alphanumeric': 0.14597123944304954, 'fraction_numerical': 0.0, 'mean_word_length': 4.53219696969697, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2016463', 'n_tokens_mistral': 2594, 'n_tokens_neox': 2616, 'n_words': 395}