-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
56 lines (36 loc) · 1.27 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
var express = require('express');
var exec = require('child_process').exec
var app = express();
var path = require('path');
app.use(express.static(path.join(__dirname, 'www'))); // "public" off of current is root
app.use(express.json());
app.listen(8080);
console.log('Listening on port 8080');
/////////////////////////////////////////////////////////
const WebSocket = require('ws');
const wss = new WebSocket.Server({ port: 9090 });
wss.on('connection', function connection(ws) {
ws.on('message', function incoming(message) {
console.log('received: %s', message);
if (message == "netflix") {
exec('/arquivos de programas/netflix/netflix.exe', function (err) {
if (err) { //process error
}
else {
console.log("success open")
}
})
}
if (message == "retro") {
exec('/arquivos de programas/retroarch/retroarch.exe', function (err) {
if (err) { //process error
}
else {
console.log("success open")
}
})
}
});
ws.send('Essa menssagem veio do servidor');
});
//////////////////////////////////////////////////////////