-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscreen.js
More file actions
23 lines (22 loc) · 734 Bytes
/
screen.js
File metadata and controls
23 lines (22 loc) · 734 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
Screen Viewer V1.0 - By Mr.Jack
Remember to: npm install socket.io
*/
try {
var io = require('socket.io', { wsEngine: 'ws' }).listen(9875);
var buffer = "";
require('net').createServer(function (socket) {
socket.on('data', function (data) {
var dt = data.toString();
if( dt.slice(-10) == "IMAGE_SENT" ){
io.sockets.emit('guardar_buffer', dt.slice(0,-10));
socket.write(JSON.stringify({response:"NOTIFICATION_SENT"}) + "\0");
io.sockets.emit('pintar_imagen');
}else{
io.sockets.emit('guardar_buffer', dt);
}
});
}).listen(9876);
} catch(err) {
console.log(err.message);
}