Loading socket.js +4 −2 Original line number Diff line number Diff line Loading @@ -162,7 +162,9 @@ server.on('connection',function(socket){ // emits when any error occurs -> calls closed event immediately after this. server.on('error',function(error){ if (error !== 'Error: This socket has been ended by the other party') { console.log('Error: ' + error); } }); //emits when server is bound with server.listen Loading Loading @@ -253,10 +255,10 @@ client.on('data',function(data){ // 87.78.129.86 | localhost // Examples: // getVotes: {"map":"OkNwgzSwDLZSWSRPsUKY7EA1Cg5","http":"GET","url":"getVotes?map=OkNwgzSwDLZSWSRPsUKY7EA1Cg5"} // setVotes: {"http":"POST", "map": "OkNwgzSwDLZSWSRPsUKY7EA1Cg5", "player": "Jtmn3kBnSSadky_mLNhp_A", "vote": 50} // setVote: {"http":"POST", "map": "OkNwgzSwDLZSWSRPsUKY7EA1Cg5", "player": "Jtmn3kBnSSadky_mLNhp_A", "vote": 50} // getPlayerVote: {"map":"OkNwgzSwDLZSWSRPsUKY7EA1Cg5","http":"GET","url":"getPlayerVote?map=OkNwgzSwDLZSWSRPsUKY7EA1Cg5&player=Jtmn3kBnSSadky_mLNhp_A"} const testClient = net.connect({host: 'localhost', port: 3000}, () => { /*const testClient = net.connect({host: '87.78.129.86', port: 3201}, () => { console.log('connected to server!'); //testClient.write('Hello World Client!\r\n'); testClient.write(JSON.stringify({"http":"POST", "map": "OkNwgzSwDLZSWSRPsUKY7EA1Cg5", "player": "Jtmn3kBnSSadky_mLNhp_A", "vote": 80})); Loading Loading
socket.js +4 −2 Original line number Diff line number Diff line Loading @@ -162,7 +162,9 @@ server.on('connection',function(socket){ // emits when any error occurs -> calls closed event immediately after this. server.on('error',function(error){ if (error !== 'Error: This socket has been ended by the other party') { console.log('Error: ' + error); } }); //emits when server is bound with server.listen Loading Loading @@ -253,10 +255,10 @@ client.on('data',function(data){ // 87.78.129.86 | localhost // Examples: // getVotes: {"map":"OkNwgzSwDLZSWSRPsUKY7EA1Cg5","http":"GET","url":"getVotes?map=OkNwgzSwDLZSWSRPsUKY7EA1Cg5"} // setVotes: {"http":"POST", "map": "OkNwgzSwDLZSWSRPsUKY7EA1Cg5", "player": "Jtmn3kBnSSadky_mLNhp_A", "vote": 50} // setVote: {"http":"POST", "map": "OkNwgzSwDLZSWSRPsUKY7EA1Cg5", "player": "Jtmn3kBnSSadky_mLNhp_A", "vote": 50} // getPlayerVote: {"map":"OkNwgzSwDLZSWSRPsUKY7EA1Cg5","http":"GET","url":"getPlayerVote?map=OkNwgzSwDLZSWSRPsUKY7EA1Cg5&player=Jtmn3kBnSSadky_mLNhp_A"} const testClient = net.connect({host: 'localhost', port: 3000}, () => { /*const testClient = net.connect({host: '87.78.129.86', port: 3201}, () => { console.log('connected to server!'); //testClient.write('Hello World Client!\r\n'); testClient.write(JSON.stringify({"http":"POST", "map": "OkNwgzSwDLZSWSRPsUKY7EA1Cg5", "player": "Jtmn3kBnSSadky_mLNhp_A", "vote": 80})); Loading