Unable to receive data from SignalR Server in iOS

随声附和 提交于 2020-01-03 19:03:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!