I'm trying to create a native iOS client for the chat example in Socket.io.
I've set up everything, but at this point...
[socketIO connectToHost:#"localhost" onPort:3000];
I get this error
ERROR: handshake failed ... Server returned status code 400
I guess I have to send some params, maybe like this...
[socketIO connectToHost:#"localhost" onPort:3000 withParams:...];
...but I have no idea what I have to send.
Thanks!
Related
My iOS app use RestKit framework for implementing RESTful web services client.
Sometimes, I have a problem when I call my server from my application.
The request is not sent and it fails at the end of the expiration with this error:
Error Domain=NSURLErrorDomain Code=-1001 "The request timed out."
At the first openning, it is impossible to reproduce this.
The problem occurs when the application is put into the background and it restarts 10 minutes later or more (it does not produce every time). At this point, there is no server side call .
Then, the only way to solve this problem is to force-quit the application.
We checked there is no error of url, of header, etc ...
HELP ME :'(
Try to set time interval like
[manager.requestSerializer setTimeoutInterval:yourTimeInterval];
I'm using URLSession to perform a datatask, when I run it on iOS 11, I get a console error:
HTTP load failed (error code: -999 [1:89]) for Task <68809C58-C6A7-4F10-86A4-81396D8B18CF>.<2>
Any thought on what's causing it, or how to fix it?
HTTP load failed (error code: -999 [1:89]) for Task
Error -999 means NSURLErrorCancelled, your request has been canceled before completion. According to the apple developer blog, there are few changes with ATS (likely that your server is using one of legacy crypto facilities that have been removed in iOS 11.) So give a try and implement the connection:didReceiveAuthenticationChallenge: and see if your server raises authentication challenge if yes then here is something we need to handle.
I hope it will help!
I had this error when trying to do the HTTPS
Request has been canceled before completion
In my case the SSL Certificated was not installed properly.
Check your SSL certificate if your using one.
Task <1> HTTP load failed (error code: -999 [1:89])
Task <>.<1> finished with error - code: -999
Make sure your internet connection is working. It happened to me that it's working in the simulator, but got the error on iphoneSE. I found it that my iphoneSE internet connection had a problem.
I am running hello monkey sample of Twilio. Everything works well (able to pass capability token). But When I press Dial button... After 5 seconds ..following error prints up
[ERROR TCMetricsPublisher] Failed to push call stats, status code: 403
2015-08-01 22:30:43.893 MyApp[2425:284133] ERROR: handshake failed ... The request timed out.
2015-08-01 22:30:43.896 MyApp[2425:284133] ERROR: handshake failed ... The request timed out.
2015-08-01 22:30:43.899 MyApp[2425:284133] ERROR: handshake failed ... The request timed out.
2015-08-01 22:30:43.912 MyApp[2425:284133] ERROR: handshake failed ... The request timed out.
2015-08-01 22:30:43.913 MyApp[2425:284133] ERROR: handshake failed ... The request timed out.
2015-08-01 22:30:43.913 MyApp[2425:284133] ERROR: handshake failed ... The request timed out.
2015-08-01 22:30:43.914 MyApp[2425:284133] ERROR: handshake failed ... The request timed out.
2015-08-01 22:30:43.914 MyApp[2425:284133] ERROR: handshake failed ... The request timed out.
2015-08-01 22:30:43.915 MyApp[2425:284133] ERROR: handshake failed ... The request timed out.
2015-08-01 22:30:43.915 MyApp[2425:284133] ERROR: handshake failed ... The request timed out.
I've been getting this at random times. How can I check exactly which framework/library is causing this? It just prints in my Xcode console.
Look hat this Question it seems to be very similar, are you using a library which using a websocket server. Maybe this can solve your Problem very fast. If not please Post a list of librarys you use and form you code where you set up a socket.
Timeouts occur if an api does not respond for a long time, which is usually set to 15, 30 or 60 seconds.
Your timestamps are split across a second as well, which clearly says that you are using a socket connection and probably a library for the same, which is the issue here. Check the library you are using. It will be a server side issue.
Some libraries in your project might use socket or SSL authentication.
In my case, I saw same error message, handshake failed, when I tried to send push notification to APNS server with wrong certificates.
It's hard to find which library or framework print out to the console.
Try to remove 3rd party libraries included in the project until the error message stops appearing.
I think you are running a websocket server for your project. You have to run a socket.io server. That's why xcode is showing this error.
See this similiar post on stackoverflow
My Socket.io on IOS fails to handshake with the websocket server
Some times when you use the push notification api sometimes the handshake failed error occurs , so read this apple documentation for trouble shooting if your push notification feature is logging this error App push notification troubleshooting
The way I can introduce may be not a good solution for you. And my answer works based on these two conditions
1.you have to comment nearlly all the "println" in your code
2.the instance call "println" to send error message
Then, you can set "Symbolic breakpoint" in "Debug menu -> Breakpoints -> Create Symbolic Breakpoint", and set condition to be "println"
(If the module is old, you may have to break at "NSLog" or some thing)
reference to how to set symbolic breakpoint: http://rshankar.com/debugging-swift-app-in-xcode/
I am using AfNetworking 1.0 into my app.I have created a singleton class of AFHTTP Client.
So all the API's are place in the same class.
I am getting a very wierd issue.
For eg: Let say, i have requested for some data from server.But the internet connection has lost.
So the failure block get's called.
m getting the following error:
Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo=0x797dcc70 {NSErrorFailingURLStringKey=https://testing.com?searchText=s&pageSize=10&pageNumber=5, _kCFStreamErrorCodeKey=57, NSErrorFailingURLKey=https://testing.com?searchText=s&pageSize=10&pageNumber=5, NSLocalizedDescription=The Internet connection appears to be offline., _kCFStreamErrorDomainKey=1, NSUnderlyingError=0x7aa367e0 "The Internet connection appears to be offline."}
But if i try to get the status code using following code:
NSLog(#"Status code %d",[operation.response statusCode]);
m getting Status Code as "0".
Can you please explain,why i am getting Status code as "0"?
I have to handle the error,depends on HTTP Status Code.So what is the best way to get this done?
(the same way which i am doing or is there any other way.)
In this case you can't use the status code because there isn't one. The status code comes from the server and in this case the client has not been able to contact the server.
You should use the error domain and code to handle this case.