Reputation: 15
I'm using the default example provided in the https://github.com/pkyeck/socket.IO-objc GitHub repo. And SocketIO throws an error that the handshake failed and the server returned with status code 400. I have successfully connected to the server with the socket.io Javascript library.
- (void) viewDidLoad
{
[super viewDidLoad];
socketIO = [[SocketIO alloc] initWithDelegate:self];
socketIO.useSecure = YES;
[socketIO connectToHost:@"[url]" onPort:443];
}
-
SocketTesterARC[2457:60b] Connecting to socket with URL: https://[url]:443/socket.io/1/?t=1397682804193
SocketTesterARC[2457:60b] didReceiveResponse() 400
SocketTesterARC[2457:60b] ERROR: handshake failed ... Server returned status code 400
SocketTesterARC[2457:60b] onError() Error Domain=SocketIOError Code=-6 "Error Domain=SocketIOError Code=400 "Server returned status code 400" UserInfo=0x1780718c0 {NSLocalizedDescription=Server returned status code 400}" UserInfo=0x178072740 {NSLocalizedDescription=Error Domain=SocketIOError Code=400 "Server returned status code 400" UserInfo=0x1780718c0 {NSLocalizedDescription=Server returned status code 400}}
Upvotes: 1
Views: 2046
Reputation: 1854
I also had such error when hard-coded my Mac's IP into iOS app code. Once I have dynamic IP, one day it has been changed and - pfff - handshake error and timeout.
Upvotes: 0
Reputation: 136
Check the version number, guess you are using version 0.9, your server side code using version 1.0. Both server and client should be in same version.
Upvotes: 1