diff --git a/atcheck-websocket/server.js b/atcheck-websocket/server.js index 04a3a08..0aa9994 100644 --- a/atcheck-websocket/server.js +++ b/atcheck-websocket/server.js @@ -27,17 +27,15 @@ var server = http.createServer(function (request, response) { }); try { request.on('end', function () { - body = JSON.parse(body); - console.log(body); - console.log(lookup); + var body = body.split("&"); var send_array = { "type": "data", - "id": body.student_index, - "name": body.student_name, - "surname": body.student_surname, - "classes_code": body.classes_code + "id": body[1], + "name": body[2], + "surname": body[3], + "classes_code": body[0] }; - lookup[body.classes_code].send(JSON.stringify(send_array)); + lookup[body[0]].send(JSON.stringify(send_array)); }); } catch (e) {console.log(e)} }