Subscribing to multiple items
I'm new to LS and am confused as to the proper approach to subscribe to multiple items with different fields using the iOS client API.
Right now I am able to subscribe to multiple items with identical fields, using the following syntax:
Code:
- (void)connectToLightstreamer {
client = [LSClient client];
LSConnectionInfo *connectionInfo = [LSConnectionInfo connectionInfoWithPushServerURL:LS_SERVER_URL pushServerControlURL:nil user:LS_API_KEY password:nil adapter:LS_ADAPTER];
[client openConnectionWithInfo:connectionInfo delegate:self];
}
- (void) clientConnection:(LSClient *)client didStartSessionWithPolling:(BOOL)polling {
if (!tableKey)
[self performSelector:@selector(subscribeItems) withObject:nil afterDelay:0.1];
}
- (void)subscribeItems {
@try {
NSArray *itemNames = [MyObjectClass itemList];
NSArray *fieldNames = [MyObjectClass fieldList];
LSExtendedTableInfo *tableInfo = [LSExtendedTableInfo extendedTableInfoWithItems:itemNames mode:LSModeMerge fields:fieldNames dataAdapter:@"TEST" snapshot:YES];
tableInfo.requestedMaxFrequency = 0.05;
tableKey = [client subscribeTableWithExtendedInfo:tableInfo delegate:self useCommandLogic:NO];
NSLog(@"Table subscribed");
} @catch (NSException *e) {
NSLog(@"Table subscription failed due to exception: %@", e);
}
}
This works fine. But what I don't understand is what the syntax would be for subscribing to additional items that have a schema (in the general sense, not the LS sense) that is different from the items in itemList above. I suppose I could just add different item types to itemNames and additional field names to fieldNames, but I feel like that could result in namespace collision or other problems if I had two different item types that happened to share a field name.
Can you clarify the proper practice for the case of subscribing to different types of items?
Thanks!
/afb