Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
mehtix1 authored Nov 15, 2024
1 parent d6d9cfb commit 5a63270
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,23 @@ <h1>WebSocket and Webhook Example</h1>
let flag = event.data;
console.log("Received message:", flag);

// Add the flag to the message queue
messageQueue.push(flag);
};
// Check if the flag is greater than 0
if (parseFloat(flag) > 0) {
// If flag is greater than 0, send POST request to Webhook
sendPostToWebhook(flag)
.then(() => {
console.log("POST request sent successfully!");
})
.catch((error) => {
console.error("Error sending POST request:", error);
});
} else {
console.log("Flag is not greater than 0, not sending POST request.");
}

// Add the flag to the message queue if needed
messageQueue.push(flag);
};

// Send POST requests at regular intervals (every 2 seconds)
setInterval(() => {
Expand Down

0 comments on commit 5a63270

Please sign in to comment.