Files
fal-swift/Sources/FalClient/Realtime+Codable.swift
Daniel Rochetti 24f531005d feat: realtime binary protocol (#3)
* feat: initial high fps sample

* fix: remove prints

* feat: realtime turbo camera demo

* fix: fps count

* chore: docs and build update

* fix: remove non-exported targets

* feat: binary realtime protocol with msgpack

* fix: update macos support to v13

* chore: rename ObjectValue to Payload
2023-12-12 11:00:07 -08:00

22 lines
720 B
Swift

import Dispatch
import Foundation
public extension Realtime {
func connect<Input: Encodable, Output: Decodable>(
to app: String,
connectionKey: String = UUID().uuidString,
throttleInterval: DispatchTimeInterval = .milliseconds(64),
onResult completion: @escaping (Result<Output, Error>) -> Void
) throws -> TypedRealtimeConnection<Input> {
handleConnection(
to: app,
connectionKey: connectionKey,
throttleInterval: throttleInterval,
connectionFactory: { send, close in
TypedRealtimeConnection(send, close)
},
onResult: completion
) as! TypedRealtimeConnection<Input>
}
}