Не приходит ответ от сервера. Где я допустил ошибку (PocketSocket)?

Всем привет! Не могу понять, у меня проблема или с сервером что-то не так?
// --- Connect to the service ---
    // create the NSURLRequest that will be sent as the handshake
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"url"]];
    
    // create the socket and assign delegate
    self.socket = [PSWebSocket clientSocketWithRequest:request];
    self.socket.delegate = self;

    // open socket
    [self.socket open];


#pragma mark - PSWebSocketDelegate

- (void)webSocketDidOpen:(PSWebSocket *)webSocket
{
    NSLog(@"The websocket handshake completed and is now open!");
    NSDictionary *send = @{@"данные"};
    
    [webSocket send:[NSJSONSerialization dataWithJSONObject:send
                                                    options:kNilOptions
                                                      error:nil]];
}

- (void)webSocket:(PSWebSocket *)webSocket didReceiveMessage:(id)message
{
    NSString *string = [[NSString alloc] initWithData:message
                                             encoding:NSUTF8StringEncoding];
    NSLog(@"The websocket received a message: %@", string);
}

- (void)webSocket:(PSWebSocket *)webSocket didFailWithError:(NSError *)error
{
    NSLog(@"The websocket handshake/connection failed with an error: %@", error);
}

- (void)webSocket:(PSWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean
{
    NSLog(@"The websocket closed with code: %@, reason: %@, wasClean: %@", @(code), reason, (wasClean) ? @"YES" : @"NO");
}
  • Вопрос задан
  • 170 просмотров
Решения вопроса 1
f0r3s1
@f0r3s1
iOS Developer
эм, а где описание? Подробно опиши какой респонс от сокета вообще есть, в какие методы заходит что пишет и тд
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы