Slide 20
Slide 20 text
PLASMASWIFT
enum EventType: RawRepresentable {
case stats(programId: String)
var rawValue: String { /* return event type string */ }
init?(rawValue: String) { /* parse payloads */ }
}
let eventTypes: [EventType]
let rawEventTypes = eventTypes.map { $0.rawValue }
let client = PlasmaClient(host: host, port: port)
client.subscribe(eventTypes: rawEventTypes, retryCount: 10) { event in
switch event {
case .next(let payload):
// Do something
case .error(let error):
// Error handling
}
}
Subscribe͢ΔΠϕϯτͷఆٛ
ResultͷΑ͏ͳenumͰ͕͞ΕΔ