我正在尝试在 iOS 应用程序中设置 SignalR-ObjC。我已经测试了从服务器到客户端的调用没有问题。我还没有让调用方法工作。
这是我设置集线器连接的地方
-(void)setupHubConnection{
hubConnection = [SRHubConnection connectionWithURL:@"http://hostname/Janus.Web/"];
janus = [hubConnection createHubProxy:@"syncHub"];
[janus on:@"picture" perform:self selector:@selector(checkStuff:)];
[janus on:@"registrationResponse" perform:self selector:@selector(gotRegistered:)];
[hubConnection start];
[self registerDevice];
}
这就是我调用服务器调用的地方
-(void)registerDevice{
NSString *os = [NSString stringWithFormat:@"%@%@", [[UIDevice currentDevice] systemName], [[UIDevice currentDevice] systemVersion]];
NSString *jsonRegister = [NSString stringWithFormat:@"{\"ClientDeviceModel\": {\"ClientID\": \"%@\",\"HardwareInfo\": \"%@\",\"OS\": \"%@\",\"AppVersion\": \"%@\",\"MessageID\": %@}}", [[UIDevice currentDevice] name], [[UIDevice currentDevice]model], os, [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"], [NSString stringWithFormat:@"%.0f", [NSDate timeIntervalSinceReferenceDate]]];
NSLog(@"%@", jsonRegister);
NSMutableArray *registerInfo = [[NSMutableArray alloc] init];
[registerInfo addObject:jsonRegister];
[janus invoke:@"RegisterClient" withArgs:registerInfo completionHandler:^(id response){
NSLog(@"%@", response);
}];
}
我没有看到这个调用 RegisterClient 调用对服务器造成任何影响。
有任何想法吗?