openClient method
Piggyback Capture's openClient and use parameters and interfaces unique to iOS connections. Incorporate iOSTransport connection and start listening to stream.
Implementation
@override
/// Piggyback Capture's openClient and use parameters and interfaces unique to iOS connections.
/// Incorporate iOSTransport connection and start listening to stream.
Future<int?> openClient(
String host, AppInfo appInfo, Function eventNotification) async {
transport ??= IosTransport();
transportNotification = IosTransportNotification();
final IosAppInfo iosAppInfo = IosAppInfo();
iosAppInfo.appId = appInfo.appIdIos;
iosAppInfo.developerId = appInfo.developerId;
iosAppInfo.appKey = appInfo.appKeyIos;
transportNotification!.startListeningForCaptureEvents(
(int result, int handle, CaptureEvent event) {
return eventNotification(event, handle);
});
try {
final IosTransportHandle handle = await transport!.openClient(iosAppInfo);
if (handle.value == 0) {
throw CaptureException(SktErrors.ESKT_INVALIDHANDLE, 'Invalid Handle',
'iOS openClient', 'Platform Exception!');
}
onEventNotification = eventNotification;
transportHandle = handle.value;
return handle.value;
} on PlatformException catch (ex) {
throw exceptionHelper('clientOpen', 1, ex);
} catch (ex) {
throw exceptionHelper('clientOpen', 0, ex);
}
}