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