Gwuh
This commit is contained in:
parent
e0ce204118
commit
12eb3aef9b
8
index.js
8
index.js
|
@ -54,6 +54,14 @@ app.post("/api/send/:jobid/:id/", (req, res) => {
|
||||||
var id = req.params.id;
|
var id = req.params.id;
|
||||||
var stats = ws_[id];
|
var stats = ws_[id];
|
||||||
var socket = ws_[id].connection;
|
var socket = ws_[id].connection;
|
||||||
|
// Catch if body is not json data
|
||||||
|
if (!req.body.data) {
|
||||||
|
res.status(400).send({
|
||||||
|
success: false,
|
||||||
|
message: "No data provided"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
console.log("sent data: " + req.body)
|
console.log("sent data: " + req.body)
|
||||||
if (stats.open == true) {
|
if (stats.open == true) {
|
||||||
socket.send(req.body.data);
|
socket.send(req.body.data);
|
||||||
|
|
Loading…
Reference in a new issue