# cancel()

### cancel(reqId\[, advancedOptions]])

RPC invocation cancelling.

Parameters:

* **reqId**. Required. Request ID of RPC call that need to be canceled.
* **advancedOptions**. Optional parameters hash table. Must include any or all of the options:
  * **mode**: string|one of the possible modes: "skip" | "kill" | "killnowait". Skip is default.

Returns `boolean` or throws `Error`:

* `true` if successfully sent canceling message
* `Error` if some error occurred

```javascript
let defer = ws.call('start.migration');
defer
    .then((result) => {
        console.log('RPC successfully called');
    })
    .catch((err) => {
        console.log('RPC call failed!', err);
});

status = ws.getOpStatus();

ws.cancel(status.reqId);
```
