在signalR中调用集线器方法 - 目标C

在signalR中调用集线器方法 - 目标C

问题描述:

我是ios开发新手。我试图实现信号R.我试过,我能够连接到集线器。但我不知道如何调用一个方法枢纽CheckWebServiceStatus在signalR中调用集线器方法 - 目标C

我收到错误

为“SRHubProxy”不可见@interface声明选择“调用:”

这里是我的代码

#import "ViewController.h" 
#import "SignalR.h" 

@interface ViewController() 

@end 

@implementation ViewController 

- (void)viewDidLoad { 
    [super viewDidLoad]; 
    // Do any additional setup after loading the view, typically from a nib. 


    SRHubConnection *hubConnection = [SRHubConnection connectionWithURLString:@"https://MY HUB URL HERE/"]; 

    // Create a proxy to the chat service 
    SRHubProxy *chat = [hubConnection createHubProxy:@"chatHub"]; 
    [chat on:@"addMessage" perform:self selector:@selector(addMessage:)]; 

    // [chat on:@"addMessage" perform:self selector:@selector(addMessage:)]; 

    // Register for connection lifecycle events 
    [hubConnection setStarted:^{ 
     NSLog(@"Connection Started"); 
     // [connection send:@"CheckWebServiceStatus"]; 
     [chat invoke:@"CheckWebServiceStatus"]; 

    }]; 
    [hubConnection setReceived:^(NSString *message) { 
     NSLog(@"Connection Recieved Data: %@",message); 
    }]; 
    [hubConnection setConnectionSlow:^{ 
     NSLog(@"Connection Slow"); 
    }]; 
    [hubConnection setReconnecting:^{ 
     NSLog(@"Connection Reconnecting"); 
    }]; 
    [hubConnection setReconnected:^{ 
     NSLog(@"Connection Reconnected"); 
    }]; 
    [hubConnection setClosed:^{ 
     NSLog(@"Connection Closed"); 
    }]; 
    [hubConnection setError:^(NSError *error) { 
     NSLog(@"Connection Error %@",error); 
    }]; 
    // Start the connection 
    [hubConnection start]; 

} 


- (void)addMessage:(NSString *)message { 
    // Print the message when it comes in 
    NSLog(@"%@", message); 
} 

- (void)didReceiveMemoryWarning { 
    [super didReceiveMemoryWarning]; 
    // Dispose of any resources that can be recreated. 
} 


@end 

有人可以告诉我如何调用使用HUB方法objecti ve c。

这里是用于调用方法的示例

- (void) sendOperatorMessage :(NSString*) visitorId Message:(NSString*) message OperatorId:(NSString*) operatorid Token:(NSString*) ProfileToken SpinnerId:(NSString*) spinnerId CurrentDateTime:(NSString*) currentDateTime{ 

    [chat invoke:@"sendMessageOperator" withArgs:[NSArray arrayWithObjects:visitorId, message, operatorid, @"false", @"false", @"false", ProfileToken, currentDateTime, spinnerId, nil]]; 
}