Skip to content

AbortController/AbortSignal #367

@francislavoie

Description

@francislavoie

I have no idea how the API would look for this (might be... complicated) but I think some considerations should be made for how abort could be integrated.

https://developer.mozilla.org/en-US/docs/Web/API/AbortController

If I'm using this client to fire off a debounced JSON-RPC search query, I'd want to be able to abort the previous query every time a new request is being fired, to avoid race conditions.

I think possibly the simplest way to support it would be to change ClientInterface.ts interface Arguments to include timeout and signal as optional properties (timeout to optionally replace the existing second arg of rpc.request() moving it into the first arg's object, can do like requestObject.timeout ?? timeout for backwards compat) and pass the signal down into the transport's sendData.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions