transfer project in github
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user