-
November 28th, 2012, 11:43 AM
#1
LS iOS LSCommand mode sample
Can anybody send me any sample code for subscribing to lightstreamer with LSCommand mode
Thank You.
-
November 29th, 2012, 04:03 PM
#2
I confirm that we don't provide such sample.
Examples of the use of COMMAND mode on the client side are only available for other libraries;
I refer, for instance, to the Basic Portfolio Demo and the Full Portfolio Demo, in pages\demos\PortfolioDemo_Basic and pages\demos\PortfolioDemo respectively.
In libraries more similar to the iOS case, there are just code samples which show the use of the APIs in the COMMAND mode case;
see, for instance, DOCS-SDKs\sdk_client_dotnet\examples\test\TestClient.cs and look for "command".
Do you have doubts on specific aspects?
-
November 29th, 2012, 11:34 PM
#3
Hello,
a sample subscription would be something like this:
LSExtendedTableInfo *tableInfo= [LSExtendedTableInfo extendedTableInfoWithItems:[NSArray arrayWithObjects:@"portfolio1", nil]
mode:LSModeCommand
fields:[NSArray arrayWithObjects:@"command", @"key", @"qty", nil]
dataAdapter:@"PORTFOLIO_ADAPTER"
snapshot:YES];
LSSubscribedTableKey *tableKey= [_client subscribeTableWithExtendedInfo:tableInfo delegate:self useCommandLogic:YES];
If you have specific doubts don't hesitate to ask.
Best regards,
Gianluca
-
November 30th, 2012, 10:54 PM
#4
Thank you @DarioCrivelli.
@gianluce.bertani I want a sample code when server push updates in didUpdateWithInfo (delegate method).
Thank You
-
December 3rd, 2012, 10:49 AM
#5
As my colleague Dario said before, we don't have a full example for command logic in Objective-C. On the didUpdateWithInfo event you should take the command, key and any other relevant data and apply them to your local copy of current data. E.g.:
// Take command and data from update
NSString *command= [updateInfo currentValueOfFieldName:@"command"];
NSString *key= [updateInfo currentValueOfFieldName:@"key"];
NSString *qty= [updateInfo currentValueOfFieldName:@"qty"];
if ([command isEqualToString:@"UPDATE"]) {
// Update qty on item <key>
} else if ([command isEqualToString:@"ADD"]) {
// Add new item <key> and set qty
} else if ([command isEqualToString:@"DELETE"]) {
// Remove item <key>
}
// Update visuals
Hope this helps.
Best regards,
Gianluca
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 09:02 PM.
Bookmarks