src/wampy.js
/**
     * RPC invocation cancelling
     *
     * @param {int} reqId RPC call request ID
     * @param {function|object} callbacks - if it is a function - it will be called if successfully
     *                          sent canceling message or it can be hash table of callbacks:
     *                          { onSuccess: will be called if successfully sent canceling message
     *                            onError: will be called if some error occurred }
     * @param {object} advancedOptions - optional parameter. Must include any or all of the options:
     *                          { mode: string|one of the possible modes:
     *                                  "skip" | "kill" | "killnowait". Skip is default.
     *                          }
     *
     * @returns {Wampy}
     */
RPC invocation cancelling
@param {int} reqId RPC call request ID
@param {function|object} callbacks - if it is a function - it will be called if successfully
sent canceling message or it can be hash table of callbacks:
{ onSuccess: will be called if successfully sent canceling message
onError: will be called if some error occurred }
@param {object} advancedOptions - optional parameter.

@returns {Wampy}
RPC invocation cancelling @param { int } reqId RPC call request ID @param { function|object } callbacks - if it is a function - it will be called if successfully sent canceling message or it can be hash table of callbacks : { onSuccess : will be called if successfully sent canceling message onError : will be called if some error occurred } @param { object } advancedOptions - optional parameter . @returns { Wampy }
cancel (reqId, callbacks, advancedOptions) {
        let err = false;
        const options = {};
        if (!this._preReqChecks(null, 'dealer', callbacks)) {
            return this;
        }
        if (!reqId || !this._calls[reqId]) {
            this._cache.opStatus = WAMP_ERROR_MSG.NON_EXIST_RPC_REQ_ID;
            if (this._isPlainObject(callbacks) && callbacks.onError) {
                callbacks.onError({ error: this._cache.opStatus.description });
            }
            return this;
        }
        if (typeof (advancedOptions) !== 'undefined') {
            if (this._isPlainObject(advancedOptions)) {
                if (Object.hasOwnProperty.call(advancedOptions, 'mode')) {
                    if (/skip|kill|killnowait/.test(advancedOptions.mode)) {
                        options.mode = advancedOptions.mode;
                    } else {
                        err = true;
                    }
                }
            } else {
                err = true;
            }
            if (err) {
                this._cache.opStatus = WAMP_ERROR_MSG.INVALID_PARAM;
                if (this._isPlainObject(callbacks) && callbacks.onError) {
                    callbacks.onError({ error: this._cache.opStatus.description });
                }
                return this;
            }
        }
        this._send([WAMP_MSG_SPEC.CANCEL, reqId, options]);
        this._cache.opStatus = WAMP_ERROR_MSG.SUCCESS;
        this._cache.opStatus.reqId = reqId;
        callbacks.onSuccess && callbacks.onSuccess();
        return this;
    }
cancel ( reqId , callbacks , advancedOptions ) { let err = false ; const options = { } ; if ( ! this . _preReqChecks ( null , 'dealer' , callbacks ) ) { return this ; } if ( ! reqId || ! this . _calls [ reqId ] ) { this . _cache . opStatus = WAMP_ERROR_MSG . NON_EXIST_RPC_REQ_ID ; if ( this . _isPlainObject ( callbacks ) && callbacks . onError ) { callbacks . onError ( { error : this . _cache . opStatus . description } ) ; } return this ; } if ( typeof ( advancedOptions ) !== 'undefined' ) { if ( this . _isPlainObject ( advancedOptions ) ) { if ( Object . hasOwnProperty . call ( advancedOptions , 'mode' ) ) { if ( / skip|kill|killnowait / . test ( advancedOptions . mode ) ) { options . mode = advancedOptions . mode ; } else { err = true ; } } } else { err = true ; } if ( err ) { this . _cache . opStatus = WAMP_ERROR_MSG . INVALID_PARAM ; if ( this . _isPlainObject ( callbacks ) && callbacks . onError ) { callbacks . onError ( { error : this . _cache . opStatus . description } ) ; } return this ; } } this . _send ( [ WAMP_MSG_SPEC . CANCEL , reqId , options ] ) ; this . _cache . opStatus = WAMP_ERROR_MSG . SUCCESS ; this . _cache . opStatus . reqId = reqId ; callbacks . onSuccess && callbacks . onSuccess ( ) ; return this ; }
RPC invocation cancelling
 @param {int} reqId RPC call request ID
 @param {function|object} callbacks - if it is a function - it will be called if successfully
                          sent canceling message or it can be hash table of callbacks:
                          { onSuccess: will be called if successfully sent canceling message
                            onError: will be called if some error occurred }
 @param {object} advancedOptions - optional parameter.
RPC invocation cancelling @param { int } reqId RPC call request ID @param { function|object } callbacks - if it is a function - it will be called if successfully sent canceling message or it can be hash table of callbacks : { onSuccess : will be called if successfully sent canceling message onError : will be called if some error occurred } @param { object } advancedOptions - optional parameter .
// WAMP SPEC: [CANCEL, CALL.Request|id, Options|dict]