RSS Git Download  Clone
Raw Blame History 456B 22 lines
const consolePrefix = 'socket.io persists'

module.exports = async (options) => {
    const {socket, payload} = options;

    try {
        let redis = socket.p3xrs.ioredis

        await redis.persist(payload.key)

        socket.emit(options.responseEvent, {
            status: 'ok',
        })
    } catch (e) {
        console.error(e)
        socket.emit(options.responseEvent, {
            status: 'error',
            error: e,
        })
    }
}