Skip to content

Feat: add a timeout option to Peer #53

Description

@huan

Currently, we can only call failPendingRequests() to make all the pending requests fail.

Sometimes it's better to set a timeout value and let the request failed automatically when it runs time out.

The simplest modification should be to add a timeout argument to failPendingRequests(timeout: number), which can be called period and clean the timeout-ed requests.

A better way to implement it might integrate the timeout with the Peer class.
For example:

interface PeerOptions {
  timeout: number
}

class Peer {
  constructor(public options: PeerOptions) {
  }

  // request will be rejected if it did not get any response from the server after timeout milliseconds.
}

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