if socket.io is connected Alamofire is not working as expected, always getting req time out error. Alamofire works if i disable Socket.io
this is the error i'm getting
Error Domain=NSURLErrorDomain Code=-1001 "The request timed out."
UserInfo={NSUnderlyingError=0x60800044c720
{Error Domain=kCFErrorDomainCFNetwork Code=-1001 "(null)"
UserInfo={_kCFStreamErrorCodeKey=-2102, _kCFStreamErrorDomainKey=4}},
NSErrorFailingURLStringKey=https://enpoint.json, NSErrorFailingURLKey=https://enpoint.json,
_kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-2102, NSLocalizedDescription=The request timed out.}
and this
_tcp_connection_write_eof_block_invoke Write close callback received error: [89] Operation canceled
kind of similar issue reported on git https://github.com/Alamofire/Alamofire/issues/1545 but no answers.
I don't know what i'm doing wrong! Any help would be appreciated
I was able to fix this issue by changing alamofire parameter encoding.
By default Alamofire sets encoding to URLEncoding
if you are not passing any encoding argument.
Use URLEncoding
for GET
and DELETE
request.
Use JSONEncoding.default
for all other requests (API should have support for this).
Still i'm not sure why it was working w/o socket and wasn't working with socket on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With