Skip to content

Commit

Permalink
Add timeout guide
Browse files Browse the repository at this point in the history
  • Loading branch information
ComradeVanti committed Jun 17, 2021
1 parent c9566c7 commit 4ecac77
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion Guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,27 @@ parsed object, like this:
```
ReceiveRequest.new(address)
.withParser(instrumentParser, { instrument -> })
```
```

## Timeouts

Most of the time, you don't want to wait for an answer from a remote forever.
This is why all `ReceiveRequests` have a standard timeout of 5000 milli-seconds,
after which a `OSCTimeoutException` is sent to the requests `onError` handler.

The timeout time can be changed by adding a `withTimout` call to the request
builder like this:

```
ReceiveRequest.new(address)
.withTimeout(1000)
```

In this case, the timeout was shortened to 1000 milli-seconds.

The timeout can also be disabled by calling `withoutTimeout` instead:

```
ReceiveRequest.new(address)
.withoutTimeout()
```

0 comments on commit 4ecac77

Please sign in to comment.