Kano001 commited on
Commit
5f0c253
1 Parent(s): a402e5e

Update server.js

Browse files
Files changed (1) hide show
  1. server.js +4 -1
server.js CHANGED
@@ -15,8 +15,11 @@ wss.on('connection', (ws) => {
15
  ws.on('message', (message) => {
16
  console.log(`Received message: ${message}`);
17
 
 
 
 
18
  // Execute the command received from the client
19
- exec(message, (error, stdout, stderr) => {
20
  if (error) {
21
  ws.send(`Error: ${error.message}`);
22
  return;
 
15
  ws.on('message', (message) => {
16
  console.log(`Received message: ${message}`);
17
 
18
+ // Convert message (Buffer) to string
19
+ const command = message.toString();
20
+
21
  // Execute the command received from the client
22
+ exec(command, (error, stdout, stderr) => {
23
  if (error) {
24
  ws.send(`Error: ${error.message}`);
25
  return;