问题
Hi I am new to SignalR Integration. SignalR connection is starting successfully, But some times I'm able to recieve data while some times I'm not able to receive data from server (connection.received method is not getting called). Please check the code below what i used and give ur suggestions.
SRHubConnection *connection = [SRHubConnection connectionWithURL:@"http://strandd-dev.azure-mobile.net/signalr"];
//connection.delegate = self;
[connection addValue:token forHTTPHeaderField:@"X-ZUMO-AUTH"];
[connection addValue:@"Basic TElWRTpKRHVrZnFGZmZNcXV3bVlnYm9Wd05ibWRoVEZuemY4" forHTTPHeaderField:@"Authorization"];
//TElWRTpKRHVrZnFGZmZNcXV3bVlnYm9Wd05ibWRoVEZuemY4
//REVWOnZPdGZOVHBnYlNxZ3RtZFZ2VENLVGVYTkxvek9CeDE2
myHub = [connection createHubProxy:@"IncidentHub"];
NSLog(@"Goutham");
connection.error = ^(NSError *error)
{
NSLog(@"error ====%@",error);
};
connection.started = ^{
NSLog(@"Connection Started");
[myHub invoke:@"GetMobileCustomerClientIncidentStatusRequest" withArgs:[NSArray arrayWithObjects:incidentGUID, nil]];
[self.delegate signalrConnectionDidStarted];
};
connection.received = ^(NSString * data)
{
NSLog(@"data ====%@",data);
[self.delegate didReceivedDataFromSignalR:data];
};
@try
{
[connection start];
}
@catch (NSException *exception)
{
NSLog(@"exception ----%@",exception);
}
@finally {
NSLog(@"------------");
}
Its killing my time, please help me.
来源:https://stackoverflow.com/questions/32477837/unable-to-receive-data-from-signalr-server-in-ios