provison - event

This commit is contained in:
CHIEFSOFT\ameye
2025-10-06 11:06:18 -04:00
parent 5d8265912d
commit 47db335ed1
+28 -24
View File
@@ -17,7 +17,7 @@ const app = express();
var jsonParser = bodyParser.json(); // express.json();
// create application/x-www-form-urlencoded parser
var urlencodedParser = bodyParser.urlencoded({ extended: false }); // express.bodyParser({extended: true});
var urlencodedParser = bodyParser.urlencoded({extended: false}); // express.bodyParser({extended: true});
app.use(urlencodedParser);
app.use(jsonParser);
@@ -25,7 +25,7 @@ app.use(cors());
app.use(cookieParser());
// parse application/vnd.api+json as json
app.use(bodyParser.json({ type: 'application/vnd.api+json' }))
app.use(bodyParser.json({type: 'application/vnd.api+json'}))
//const socket = io.connect(process.env.SOCKET_URL);
const socket = io.connect("http://10.10.10.13:5005");
@@ -33,32 +33,36 @@ const socket = io.connect("http://10.10.10.13:5005");
// respond with "hello world" when a GET request is made to the homepage
app.get('/broadcast/general', (req, res) => {
logger.info('***** Server PROVISION GENERAL MESSAGE ********* ');
const room = 'merms_global_events';
const message_action = 'refresh_all_actions';
socket.emit("join_room", room);
socket.emit("send_message", { message_action , room });
res.send('hello world')
logger.info('***** Server PROVISION GENERAL MESSAGE ********* ');
const room = 'merms_global_events';
const message_action = 'refresh_all_actions';
socket.emit("join_room", room);
socket.emit("send_message", {message_action, room});
res.send('hello world')
})
app.get('/broadcast/selected', (req, res) => {
logger.info('***** Server PROVISION SELECTED MESSAGE ********* ');
const room = 'merms_selected_events';
const message_action = 'refresh_selected_actions';
socket.emit("join_room", room);
socket.emit("send_message", { message_action , room });
res.send('hello world')
logger.info('***** Server PROVISION SELECTED MESSAGE ********* ');
const room = 'merms_selected_events';
const message_action = 'refresh_selected_actions';
socket.emit("join_room", room);
socket.emit("send_message", {message_action, room});
res.send('hello world')
})
app.get('/broadcast/provisioning', (req, res) => {
logger.info('***** Server PROVISION STEPS MESSAGE ********* ');
logger.info( req.query.product_uid );
const room = req.query.product_uid;
//const room = 'merms_provision_events';
const message_action = 'refresh_provision_actions';
socket.emit("join_room", room);
socket.emit("send_message", { message_action , room });
res.send('hello world')
logger.info('***** Server PROVISION STEPS MESSAGE ********* ');
logger.info(req.query.product_uid);
const room = req.query.product_uid;
const message_action = 'refresh_provision_actions';
socket.emit("join_room", room);
socket.emit("send_message", {message_action, room});
const provRoom = "PROVISION_" + req.query.product_uid
socket.emit("join_room", provRoom);
socket.emit("send_message", {message_action, room});
res.send('hello world')
})
// // respond with "hello world" when a GET request is made to the homepage
@@ -74,6 +78,6 @@ app.get('/broadcast/provisioning', (req, res) => {
const routes = require('./api/routes');
routes(app);
app.listen(port, "0.0.0.0", function() {
logger.info('***** Server started on port: ' + port + ' *****');
app.listen(port, "0.0.0.0", function () {
logger.info('***** Server started on port: ' + port + ' *****');
});