socket/ClientErrorTransaction.js

/**
 * @module flitter-socket/ClientErrorTransaction
 */

const Transaction = require('./Transaction')

/**
 * Special transaction type used when a client message
 * has come in, but is invalid.
 * @extends module:flitter-socket/Transaction~Transaction
 */
class ClientErrorTransaction extends Transaction {

    /**
     * Set values on the outgoing data.
     * @param key
     * @param value
     * @returns {ClientErrorTransaction} - for chaining
     */
    set(key, value = null){
        if ( value && typeof this.outgoing === 'object' ) this.outgoing[key] = value
        else this.outgoing = key
        
        return this
    }
    
}

module.exports = exports = ClientErrorTransaction