Files
barg-restuarant/server/socket/adminNotify.js
T
hamid.zarghami1@gmail.com e644edbd65 transfer project in github
2024-05-12 15:29:27 +03:30

29 lines
661 B
JavaScript

const Order = require('../models/Order')
module.exports.initAdmin = async () => {
try {
global.adminIo = io.of('/admin')
// admins middlewares1
// admin.use(isAdmin)
// attach events
adminIo.on('connection', socket => {
console.log('admin connected')
/// /////////////////////////////////////////////////////// handle connection error
socket.on('connect_error', err => {
console.log(err.message)
})
})
}catch (e) {
console.log(e.message)
}
}
module.exports.sendNotifyOrder = async (branchId) => {
try {
adminIo.emit('order' , {branchId})
}catch (e) {
console.log(e.message)
}
}