diff --git a/atcheck-websocket/server.js b/atcheck-websocket/server.js index 54fd923..04a3a08 100644 --- a/atcheck-websocket/server.js +++ b/atcheck-websocket/server.js @@ -9,7 +9,6 @@ console.log("Websocket server running on port " + websocket_port); var lookup = []; wss.on('connection', function connection(ws) { - console.log(ws); lookup[ws.protocol] = ws; }); /*{ @@ -26,20 +25,21 @@ var server = http.createServer(function (request, response) { request.on('data', function (chunk) { body += chunk; }); - - request.on('end', function () { - body = JSON.parse(body); - console.log(body); - console.log(lookup); - var send_array = { - "type": "data", - "id": body.student_index, - "name": body.student_name, - "surname": body.student_surname, - "classes_code": body.classes_code - }; - lookup[body.classes_code].send(JSON.stringify(send_array)); - }); + try { + request.on('end', function () { + body = JSON.parse(body); + console.log(body); + console.log(lookup); + var send_array = { + "type": "data", + "id": body.student_index, + "name": body.student_name, + "surname": body.student_surname, + "classes_code": body.classes_code + }; + lookup[body.classes_code].send(JSON.stringify(send_array)); + }); + } catch (e) {console.log(e)} } else { response.end("Undefined request ."); diff --git a/lsscanner/new_ubuntu/main.js b/lsscanner/new_ubuntu/main.js index 9f679d5..82c39b7 100755 --- a/lsscanner/new_ubuntu/main.js +++ b/lsscanner/new_ubuntu/main.js @@ -297,7 +297,7 @@ function printStudent(item) { }); -axios.post('http://150.254.78.197:8889', JSON.stringify({ +axios.post('https://atcheck.projektstudencki.pl/students', JSON.stringify({ classes_code: class_code, student_index: item[2], student_name: item[0],