Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easy configuration of global NetworkSession timeouts & more URLSessionConfiguration convenience #9

Merged
merged 1 commit into from
May 24, 2021

Conversation

kdubb
Copy link
Contributor

@kdubb kdubb commented May 24, 2021

Fixes #1

NetworkRequestFactory configuratoin

NetworkRequestSession.init now accepts an eventSession parameter that is used solely when creating requests for EventSource & EventPublusher instances.. The parameter defaults to nil in which case it is coped from the standard session parameter. When copying the regular session it uses the new URLSessionConfiguration.events() convenience factory (see below).

URLSessionConfiguration for “events”

Since Server-Sent Event requests have special requirements (e.g. long timeouts) a convenience extension factory method events() has been added. It creates a configuration sutiable for SSE streams.

Global defaults

All of the defaults used by the URLSessionConfiguration extension factoires (both rest() and events()) now have configurable default values for easy global configuration.

…sionConfiguration` convenience

Fixes #1

### NetworkRequestFactory configuratoin
`NetworkRequestSession.init` now accepts an `eventSession` parameter that is used solely when creating requests for `EventSource` & `EventPublusher` instances..  The parameter defaults to `nil` in which case it is coped from the standard `session` parameter. When copying the regular session it uses the new `URLSessionConfiguration.events()` convenience factory (see below).

### URLSessionConfiguration for “events”
Since Server-Sent Event requests have special requirements (e.g. long timeouts) a convenience extension factory method `events()` has been added. It creates a configuration sutiable for SSE streams.

### Global defaults
All of the defaults used by the `URLSessionConfiguration` extension factoires (both `rest()` and `events()`) now have configurable default values for easy global configuration.
@kdubb kdubb force-pushed the feature/network_config branch from 1370e98 to 22d0950 Compare May 24, 2021 00:16
@kdubb kdubb merged commit 17af563 into main May 24, 2021
@kdubb kdubb deleted the feature/network_config branch May 24, 2021 00:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EventSource inherits a small timeout from the RequestFactory that created it
1 participant