nuclearace / Socket.IO-Client-Swift

socket.io-client for Swift
Other
361 stars 53 forks source link

Objective-C can't connect to server #114

Open programmerC opened 8 years ago

programmerC commented 8 years ago

Hello!

Please help me to solve this problem.

Thanks in advance!

Code: self.socket = [[SocketIOClient alloc] initWithSocketURL:url options:@{@"log":@YES, @"forcePolling":@YES, @"nsp":@"/im", @"ConnectParams":@{@"token":self.demo_Token}}];

[self.socket on:@"connect" callback:^(NSArray * _Nonnull data, SocketAckEmitter * _Nonnull ack) {
    NSLog(@"actNum:%ld",ack.ackNum);
}];

[self.socket on:@"system" callback:^(NSArray *data, SocketAckEmitter *ack) {
    NSLog(@"%@",data);
}];

2016-03-21 15:20:25.039 Demo[4672:201481] LOG SocketParser: Decoded packet as: SocketPacket {type: 4; data: [{ code = "credentials_required"; message = "No Authorization header was found"; type = UnauthorizedError; }]; id: -1; placeholders: -1; nsp: /im} 2016-03-21 15:20:25.040 Demo[4672:201481] LOG SocketIOClient: Handling event: error with data: ( { code = "credentials_required"; message = "No Authorization header was found"; type = UnauthorizedError; } )