func handleEvent()

in AppSyncRTCSample/AppSyncRTCProvider.swift [93:125]


    func handleEvent(event: SubscriptionItemEvent) {
        events.append(event)

        switch event {
        case .connection(let connectionEvent):
            switch connectionEvent {
            case .connected:
                connectionState = .connected
            case .connecting:
                connectionState = .inProgress
            case .disconnected:
                connectionState = .notConnected
            }

        case .failed(let error):
            OSLog.subscription.log(
                "event is error:\(error)",
                log: .subscription,
                type: .error
            )
            AppSyncSubscriptionConnection.logExtendedErrorInfo(for: error)

            lastError = error

        case .data(let data):
            OSLog.subscription.log(
                "event is data:\(data)",
                log: .subscription,
                type: .debug
            )
            lastData = String(data: data, encoding: .utf8)
        }
    }