{ "version": 3, "sources": ["../../../Scripts/main/BaseHub.ts"], "sourcesContent": ["\uFEFFlet RegularBaseHubDisconnect: boolean = false;\nlet tryingToReconnect: boolean = false;\nlet ReconnectCount: number = 0;\nlet MaxReconnectCount: number = 3;\n\nnamespace WebPortal.Hub {\n export class BaseHub {\n constructor() {\n this.initBaseHub();\n }\n\n protected HubObj: any;\n\n public WebPortalHub(): any {\n return this.HubObj;\n }\n\n public initBaseHub(): void {\n console.info(\"WebPortalHub - create hub\");\n this.HubObj = $.connection.WebPortalHub;\n $.connection.hub.qs = { \"UserIdent\": $(\"#hdf_se_request_param\").val() };\n\n // this function is executed when the state of the connection changes\n $.connection.hub.stateChanged((state: SignalR.StateChanged) => {\n let stateConversion: string[] = [\"connecting\", \"connected\", \"reconnecting\", \"\", \"disconnected\"];\n console.info(\"SignalR state changed from: \" + stateConversion[state.oldState] + \" to: \" + stateConversion[state.newState]);\n\n // childs informieren, dass der Hub verbunden ist\n if (state.newState === $.signalR.connectionState.connected) {\n this.isconnected();\n }\n });\n\n // this function is executed when the connection is slow\n $.connection.hub.connectionSlow(() => {\n let reconnectCause = \"We are currently experiencing difficulties with the connection.\";\n console.warn('SignalR ConnectionSlow - ' + reconnectCause);\n // Show_Status_Message_Cause(\"Connection slow\", reconnectCause, true);\n });\n\n $.connection.hub.reconnecting(() => {\n tryingToReconnect = true;\n let reconnectCause = \"We are currently experiencing difficulties with the connection.
We try an automatic reconnection attempt.
If this message is turned off then please press F5 to restore the session or wait a while.\";\n if (Misc.isRmsClient()) {\n reconnectCause = \"We are currently experiencing difficulties with the connection.
We try an automatic reconnection attempt.
If this message is turned off then please press ctrl + r to restore the session or wait a while.\";\n }\n console.warn('SignalR Reconnecting - ' + reconnectCause);\n Show_Status_Message_Cause(\"Reconnecting\", reconnectCause, false);\n });\n\n $.connection.hub.reconnected(() => {\n tryingToReconnect = false;\n ReconnectCount = 0;\n console.info('SignalR Reconnected');\n Close_Status_Message();\n });\n\n // Information about Lifetime Events\n // https://docs.microsoft.com/en-us/aspnet/signalr/overview/guide-to-the-api/handling-connection-lifetime-events\n $.connection.hub.disconnected(function () {\n console.error(\"SignalR Disconnected\");\n if ($.connection.hub.lastError) { console.error(\"Disconnected Reason: \" + $.connection.hub.lastError.message); }\n\n if (!RegularBaseHubDisconnect && !tryingToReconnect) {\n if (ReconnectCount < MaxReconnectCount) {\n ReconnectCount++;\n console.error(\"SignalR Reconnect in 1 Second\");\n setTimeout(function () {\n $.connection.hub.start();\n }, 1000);\n } else {\n try {\n this.onConnectionInterrupted();\n } catch (exc) {\n console.error(exc.message);\n }\n }\n }\n });\n\n // this function is executed when an error occurs\n $.connection.hub.error((error: SignalR.ConnectionError) => {\n console.error(\"SignalR error: \" + error);\n this.onConnectionInterrupted();\n });\n\n try {\n // start the connection.\n $.connection.hub.logging = true;\n $.connection.hub.start({ transport: [\"webSockets\", \"serverSentEvents\", \"longPolling\"] })\n .done(() => {\n console.log(\"Connected, transport = \" + $.connection.hub.transport.name);\n })\n .fail(() => {\n console.error(\"Could not Connect!\");\n this.onConnectionInterrupted();\n });\n } catch (exc) {\n console.error(exc.message);\n };\n\n this.HubObj.client.ShowException = (_Cause: string) => {\n Show_Status_Message_Cause(\"Error\", _Cause, false);\n };\n\n this.HubObj.client.ShowCause = (_Title: string, _Cause: string, _ShowClose: boolean) => {\n Show_Status_Message_Cause(_Title, _Cause, _ShowClose);\n };\n\n this.HubObj.client.ShowMessage = (_Cause: string) => {\n console.log(_Cause);\n //if (!isRDPConnectionStarted) {\n Show_Status_Message({ title: \"Status\", message: _Cause, progress: true });\n // }\n };\n\n this.HubObj.client.ShowStatusInfo = (_Tag: string, _Cause: any, _Timeout: any = 5000, _WithBackgroundBlur: any = false) => {\n navigationMessage.show(_Tag, _Cause, _Timeout, _WithBackgroundBlur);\n };\n\n this.HubObj.client.ShowStatusMessageInConsole = (_Cause: string) => {\n console.info(_Cause);\n };\n\n this.HubObj.client.PrepareMessageUpdate = (_MessageProviderObj: any) => {\n MessageProviderObj = _MessageProviderObj;\n notificationCenter.PrepareNotificationCenter()\n notification.showNotifcationPopup();\n };\n\n this.HubObj.client.BackendInitialized = () => {\n console.info(\"Backend Initialized (Session Verified), start KeepAlive Timer\");\n // aktualisiert die MasterSession beim AuthenticationManager (alle 30 Sekunden - eine Sek in Ausf\u00FChrung)\n SessionKeepAliveTimerVar = setInterval(() => onSessionKeepAliveTimer(), 29000);\n // Aktionen, welche nach einer sauberen Initialisierung durchgef\u00FChrt werden sollen (z.B. Session verbinden)\n this.onInitializedBackend();\n }\n\n this.HubObj.client.OnRefreshSessionResponse = (_ResultState: boolean) => {\n console.debug(\"Refresh Session Response - ResultState: \" + _ResultState);\n if (_ResultState) {\n SessionKeepAliveCount = SessionKeepAliveCountMax;\n }\n }\n\n // Der WebServer hat SessionEnd getriggert. Die Seite wird entladen\n this.HubObj.client.StopConnectionOnSessionEnd = () => {\n console.error(\"The Session on the WebServer has ended, the Page will be unloaded\");\n ActualPage.PageUnLoad();\n\n setTimeout(() => {\n Show_Status_Message_Cause(\"Web Server Session ended\", \"The Session on the Web Server has ended, the Page will be unloaded. Please restart for future work.\", false);\n }, 500);\n };\n\n // parameter\n this.HubObj.state.ResolutionWidth = screen.width;\n this.HubObj.state.ResolutionHeight = screen.height;\n this.HubObj.state.sender_url = window.location.hostname + \" - \" + window.location.pathname;\n // weitere Parameter deklaration \"LocalIpAddress\" in Main.ts (muss verz\u00F6gert gesetzt werden k\u00F6nnen)\n }\n\n protected isconnected(): void {\n console.info(\"SignalR ist connected\");\n\n // Erst alle Status Messages schliessen, wenn der Status TryingToReconnect ist.\n // Damit wird verhindert, dass im Session Join die Statusmeldung nicht zu fr\u00FCh geschlossen wird (REMAS-2495)\n if (tryingToReconnect) {\n console.info(\"Closing possible status message\");\n Close_Status_Message();\n }\n let code = Misc.getUrlParameter(\"code\");\n let state = Misc.getUrlParameter(\"state\");\n\n if (code && state) {\n console.info(\"doOidbLoginWithAuthManager\");\n this.HubObj.server.doOidbLoginWithAuthManager(code, state);\n }\n\n if (!LoginRequired) {\n let requestParam: string = $(\"#hdf_se_request_param\").val();\n if (!!requestParam) {\n if (FirstHubConnecting) {\n console.info(\"doInitializeBackend\");\n this.HubObj.server.doInitializeBackend(requestParam);\n }\n } else {\n console.error(\"Error, no Request String found!\");\n }\n }\n }\n\n protected onInitializedBackend(): void {\n console.info(\"onInitializedBackend\");\n }\n\n // Wird auch aufgerufen, wenn das Netzwerk kurz unterbricht z.B. von Kabel auf WLAN\n protected onConnectionInterrupted(): void {\n console.error(\"onConnectionInterrupted\");\n if (!RegularBaseHubDisconnect) {\n if (Misc.isRmsClient()) {\n Show_Status_Message_Cause(\"Connection Error\", \"The connection to RMS was interrupted.
Please press ctrl + r to restore the Session or restart RMS\", false);\n } else {\n Show_Status_Message_Cause(\"Connection Error\", \"The connection to RMS was interrupted.
Please press F5 to restore the Session or restart RMS\", false);\n }\n }\n }\n }\n}"], "mappings": "AAAA,IAAI,2BAAoC;AACxC,IAAI,oBAA6B;AACjC,IAAI,iBAAyB;AAC7B,IAAI,oBAA4B;AAEhC,IAAU;CAAV,SAAUA,YAAS;AAAC,MAAA;AAAA,GAAA,SAAAC,MAAG;AACnB,QAAA;;MAAA,WAAA;AACI,iBAAAC,WAAA;AACI,eAAK,YAAW;QACpB;AAIO,QAAAA,SAAA,UAAA,eAAP,WAAA;AACI,iBAAO,KAAK;QAChB;AAEO,QAAAA,SAAA,UAAA,cAAP,WAAA;AAAA,cAAA,QAAA;AACI,kBAAQ,KAAK,2BAA2B;AACxC,eAAK,SAAS,EAAE,WAAW;AAC3B,YAAE,WAAW,IAAI,KAAK,EAAE,aAAa,EAAE,uBAAuB,EAAE,IAAG,EAAE;AAGrE,YAAE,WAAW,IAAI,aAAa,SAAC,OAA2B;AACtD,gBAAI,kBAA4B,CAAC,cAAc,aAAa,gBAAgB,IAAI,cAAc;AAC9F,oBAAQ,KAAK,iCAAiC,gBAAgB,MAAM,QAAQ,IAAI,UAAU,gBAAgB,MAAM,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