Popularity
0.2
Declining
Activity
3.9
Declining
0
1
0

Description

Performs several HTTP calls synchronously in most reliable way.

Programming language: Swift
Tags: Swift     iOS     HTTP     macOS     Swiftpm     Synchronous     SPM     Swift Package Manager    
Latest version: v0.0.3

SyncHTTP alternatives and similar libraries

Based on the "UI" category

Do you think we are missing an alternative of SyncHTTP or a related project?

Add another 'UI' Library

README

SyncHTTP

Eonil, 2019.

Build Status

Performs several HTTP calls synchronously in most reliable way.

  • There are small needs for synchronous HTTP calls in Swift.
  • Unfortunately URLSession is asynchronous only.
  • There are several pitfalls to make it synchronous.

This library provide these features.

  • Synchronous HTTP call using URLSession.
  • This does not involve semaphore or lock.
    • Semaphores are likely to cause some subtle issues with URLSession.
    • Based on repeated thread sleeping.
  • Carefully designed and tuned for short-running, CLI programs.
    • Never cached.
    • State-less.
    • Fails faster than default. 10 second timeout.
  • Maybe doesn't work well in other situations.

  • Future proof simple API.

    • Implementation can be replaced for better one later.
    • You don't have to change your code.

Getting Started

Add Swift package.

.package(url: "https://github.com/eonil/swift-sync-http", from: "0.0.3"),

Import.

import SyncHTTP

And use.

let reply = try SyncHTTP.get(address: "https://google.com")
print(reply)

License & Credits

Licensed under "MIT License". Copyright(C) Eonil 2019.


*Note that all licence references and agreements mentioned in the SyncHTTP README section above are relevant to that project's source code only.