/**
 * Created by EUGENE on 10.03.2016.
 */
//server side of project
var app = require('express')();
var server = require('http').Server(app),
var io = require('socket.io')(server),
var path = require('path');

app.use(express.static(path.resolve(__dirname, 'client')));
server.listen(8080, function(){
    console.log("server is listening");
});

io.on('connection', function(socket){
    socket.on("xyz", function(x,y){
        console.log(x+"   "+y);
    });
});

@@ -278,126 +278,626 @@
 );%0D%0A
-server.listen(8080, function()%7B%0D%0A    console.log(%22server is listening%22);%0D%0A%7D);%0D%0A%0D%0Aio.on('connection', function(socket)%7B
+// variables to separate sockets from android and web-page%0D%0Avar display,%0D%0Aandroid;%0D%0A%0D%0A// socket connection%0D%0Aio.on('connection', function(socket)%7B%0D%0A%09socket.on(%22android%22, function(data)%7B%0D%0A%09   %09// if web-page connected%0D%0A%09   %09if(data === 0)%7B %0D%0A      display = socket;%0D%0A      console.log(%22conected web-page%22);%0D%0A    %7D%0D%0A    else%7B%0D%0A      android = socket;%0D%0A      console.log(%22conected client%22);%0D%0A    %7D%0D%0A  %7D);%0D%0A     // an event from client with coordinates of accelerometer%0D%0Asocket.on(%22xyz%22, function(x,y)%7B%0D%0A     // send these coordinates to index.html%0D%0A%09display.emit(%22getTime%22, x, y);%0D%0A        console.log(x+%22   %22+y);%0D%0A    %7D);
 %0D%0A  
@@ -901,35 +901,36 @@
 %0A    socket.on(%22
-xyz
+keys
 %22, function(x,y)
@@ -929,52 +929,190 @@
 ion(
-x,y)%7B%0D%0A        console.log(x+%22   %22+y
+upS,downS,rightS,leftS)%7B%0D%0A     // send these coordinates to index.html%0D%0A%09display.emit(%22sendKeys%22,upS,downS,rightS,leftS);%0D%0A        console.log(upS,downS,rightS,leftS);%0D%0A    %7D
 );%0D%0A    
 %7D);%0D
@@ -1111,14 +1111,104 @@
     
+%0D%0A
 %7D);%0D%0A
+%0D%0A%0D%0Aserver.listen(8080, function()%7B%0D%0A    console.log(%22server is listening on 8080%22);%0D%0A
 %7D);%0D%0A
+%0D%0A

Update index.js