var ws; //Port-Informationen var searchContent = new URLSearchParams (window.location.search); var svc = searchContent.get('svc'); var typeId = searchContent.get('typeid'); var port = searchContent.get('port'); //Modul importieren const importPath = './modules/' + svc + typeId + '.js' const module = await import (importPath); //HTML-Elemente get/set var serverConnect = document.getElementById('Serverconnect'); var requestContainer = document.getElementById('RequestContainer'); document.getElementById('headline').innerHTML += " - " + module.getLongName(); //Import document.title += " - " + module.getLongName(); //Import //IP-Adresse ausfuellen document.getElementById("IpInputForm").value = "ws://localhost:" + port; //Connect document.getElementById("ConnectButton").addEventListener ('click', webSocketConnect); function webSocketConnect () { ws = new WebSocket (document.getElementById("IpInputForm").value); ws.onopen = function () { document.getElementById("IpInputForm").classList.replace("border-danger", "border-success"); document.getElementById('RequestContainer').hidden = false; module.createButtons(ws); //Import } ws.onmessage = function (msg) { console.log(JSON.parse(msg.data)); module.decryptMessage (msg); //Import } ws.onclose = function () { document.getElementById("IpInputForm").classList.replace("border-success", "border-danger"); } } //Clear Button document.getElementById("ClearBtn").addEventListener('click', () => { document.getElementById("Output").innerHTML = ""; }); //Request-Funktionen function customRequest() { ws.send(JSON.stringify({ type: document.getElementById("CustomRequestType").value, uuid: document.getElementById("CustomRequestUUID").value })); } function servicePortsInformationRequest() { ws.send(JSON.stringify({ type: "servicePortsInformationRequest", uuid: "UUID" })); } function baseDlRequest() { ws.send(JSON.stringify({ type: "baseDlRequest", uuid: "UUID" })); } function exerciseInformationRequest() { ws.send(JSON.stringify({ type: "exerciseInformationRequest", uuid: "UUID" })); } function pdfListRequest() { ws.send(JSON.stringify({ type: "pdfListRequest", uuid: "UUID" })); } function equipmentTypesRequest() { ws.send(JSON.stringify({ type: "equipmentTypesRequest", uuid: "UUID" })); } //baseDlRequest //exerciseInformationRequest //pdfListRequest //servicePortsInformationRequest //exercisesRequest //participantsRequest //equipmentTypesRequest //participantRegisterInExconRequest