Appearance
FlakeClient
Client to handle a connection via the flake protocol
swift
final class FlakeClient
Overview
This client allows you to:
manage the ConnectionStatus
register for services, via
UUID
or FlakeRepresentableregister a handler for CustomMessages
Initializers
init(configuration:wire:authenticationProvider:statusListener:)
swift
init(configuration: FlakeClientConfiguration, wire: Wire, authenticationProvider: AuthenticationProvider, statusListener: ConnectionStatusListener) async
Creates a Flake Client
Instance Properties
connectionStatus
swift
var connectionStatus: ConnectionStatus
Current ConnectionStatus
connectionStatusPublisher
swift
var connectionStatusPublisher: AnyPublisher<ConnectionStatus, Never>
ConnectionStatus Publisher
Instance Methods
connect()
swift
func connect() async throws
Will open the Wire and send a connect
Message using the authentication provider if provided with init(configuration:wire:authenticationProvider:statusListener:)
disconnect()
swift
func disconnect()
Will close the connection
fetchObjects(newObjectsHandler:destroyedObjectsHandler:)
swift
func fetchObjects<Object>(newObjectsHandler: (Object) -> Void, destroyedObjectsHandler: (Address) -> Void) async throws -> [Object]
Fetch FlakeObject and wrap them in an user defined FlakeRepresentable object
fetchObjects(ofType:newObjectsHandler:destroyedObjectsHandler:)
swift
func fetchObjects(ofType: UUID, newObjectsHandler: (FlakeObject) -> Void, destroyedObjectsHandler: (FlakeObject) -> Void) async throws -> [FlakeObject]
Fetch Objects of spezified Type
knownObjects()
swift
func knownObjects() async -> Set<FlakeObject>
Provides a Set of currently available FlakeObjects
registerHandlerForCustomMessages(_😃
swift
func registerHandlerForCustomMessages((CustomMessage) -> Void) async
Register a handler to receive CustomMessages