UNPKG

ndut-socket-io

Version:
16 lines (14 loc) 426 B
const login = require('./auth/login') module.exports = async function (socket) { const { _ } = this.ndut.helper this.log.info(`[sio] Socket '${socket.id}' connected`) const { emit } = this.ndutSocketIo.helper const token = _.get(socket, 'handshake.auth.token') if (token && this.ndutAuth) { try { await login.call(this, socket, token) } catch (err) { console.log(err) } } }