func sendEvents()

in AmazonChimeSDK/AmazonChimeSDK/ingestion/DefaultEventSender.swift [26:46]


    func sendEvents(ingestionRecord: IngestionRecord, completionHandler: @escaping (Bool) -> Void) {
        do {
            let encodedRecord = try JSONEncoder().encode(ingestionRecord)
            HttpUtils.post(url: ingestionConfiguration.ingestionUrl,
                           jsonData: encodedRecord,
                           logger: logger,
                           httpRetryPolicy: DefaultBackoffRetry(maxRetry: ingestionConfiguration.retryCountLimit,
                                                                   backOffInSeconds: 0,
                                                                   retryableStatusCodes: retryableStatusSet),
                           headers: ["Authorization": "Bearer \(ingestionConfiguration.clientConfiguration.eventClientJoinToken)"]) { _, error in
                if error != nil {
                    completionHandler(false)
                } else {
                    completionHandler(true)
                }
            }
        } catch {
            logger.error(msg: "Unable to encode ingestion \(error.localizedDescription)")
            completionHandler(false)
        }
    }