Closed osirvics closed 1 month ago
When constructing the EventSource
, you must provide a Config
. This Config
allows you to provide additional headers that will be sent on each request. You can see an example below.
import Foundation
import LDSwiftEventSource
class MyEventHandler: EventHandler {
// implementation ignored for brevity
}
var eventHandler = MyEventHandler()
var config = EventSource.Config(handler: eventHandler, url: url)
config.headers = ["Authorization": "WHATEVER YOU WANT"]
var eventSource = EventSource(config: config)
eventSource.start()
Many thanks 🙏
Will appreciate it if I can get a sample on how authentication, like an access token or cookies can be added to the request