automerge / automerge-repo-swift

Extends the Automerge-swift library, providing support for working with multiple Automerge documents at once, with pluggable network and storage providers.
https://swiftpackageindex.com/automerge/automerge-repo-swift/documentation/automergerepo
MIT License
23 stars 4 forks source link

`WebSocketProvider` accepts an `URLRequest` to connect #122

Closed marionauta closed 4 days ago

marionauta commented 4 days ago

In addition to URL, you can use a URLRequest to WebSocketProvider to connect to. This is needed for connecting to sync servers that require custom headers, for example.

var request = URLRequest(url: URL(string: "wss://example.com")!)
request.addValue("token", forHTTPHeaderField: "Authorization") // for example
let websocket = WebSocketProvider(.default)
websocket.connect(to: request)
heckj commented 4 days ago

Nice! Thanks for the refactoring to provide accepting URLRequest as well as URL!