> For the complete documentation index, see [llms.txt](https://ksdaemon.gitbook.io/wampy.js/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ksdaemon.gitbook.io/wampy.js/api/cancel.md).

# 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);
```
