//
// ViewController.h
#import <UIKit/UIKit.h>
#import "MBProgressHUD.h"
#import "SocketIOConnection.h"
@interface ViewController : UIViewController <MBProgressHUDDelegate, SocketIOConnectionDelegate>
{
MBProgressHUD *HUD;
}
@property (nonatomic, retain) SocketIOConnection *IOConnection;
@end
//
// ViewController.m
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController {
NSDictionary *operatorData;
}
@synthesize SESSION, IOConnection;
#pragma mark - view Did Load, View Will Appear & didReceiveMemoryWarning
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
-(void)viewWillAppear:(BOOL)animated {
IOConnection = [SocketIOConnection sharedSingleton];
// fire auth function to verify the operator and sign him in.
NSMutableDictionary *tokenAndLicense = [[NSMutableDictionary alloc] init];
[tokenAndLicense setValue:[operatorData objectForKey:@"token"] forKey:@"__ca.token"];
[tokenAndLicense setValue:[operatorData objectForKey:@"license"] forKey:@"__ca.license"];
[IOConnection.IO sendEvent:@"auth" withData:tokenAndLicense];
}
-(void)receivedPacket:(id)packet { <<<< void that should be fired because of the delegate
NSLog(@"Receive ieks..");
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end