Does afnetworking support web socket handling? - ios

Do we have facility for working with WebSockets in AFNetworking for iOS?

No unfortunately AFNetworking doesn't support websocket handling, I am using SocketRocket for websocket handling.

Related

iOS: How to connect protoo-server with swift

I'm doing a project of mediasoup with swift. The mediasoup server is using protoo server. But there is no protoo client on swift. I tried to use WebSocket. It also fail. Is there any way to connect protoo server on swift?

Connect to XMPP over websocket on iOS?

I need to connect to an XMPP server over websocket on iOS (ws://chat.something.com:1234/websocket). I am using XMPPFramework, but I cannot find a way to make it connect over websocket.
I found this answer https://stackoverflow.com/a/23114564/310121 that suggests that XMPPFramework doesn't support this. As far as I can tell, that seems to be true.
So is there any way to connect to an XMPP server over websocket on iOS without writing your own library or extending XMPPFramework (or some alternative library) to support this?
XMPPFramework uses TCP sockets. It has not provided any API's or provision for websockets.
In order to connect with your server using websockets, you will have to alter XMPP Library's code.
I had the same issue, and i resolved it by replacing XMPPStream class of XMPPFramework (that deals with the actual TCP socket connection) with custom stream class, and used SocketRocket library to connect over websocket with my server.

Can I turn SPDY off in an iOS app that uses NSURLSession?

My iOS app is having networking issues when it loads images from an HTTPS nginx web server with SPDY enabled. The issue is described here: Sending SPDY requests results in "The request timed out" errors with NSUrlSession in iOS
I am using NSURLSession for my networking. I did experiments and confirmed that my problem is fixed if I turn SPDY off on the server side. Unfortunately I can not turn SPDY off on production nginx server because I have no control over it. Can I turn SPDY off in the iOS app instead?
OS X: 10.10.4 (14E46), iOS: 8 and 9, Xcode: 7.0 (7A218), nginx: 1.9.4
You might be able to pre-populate the Upgrade header field in your NSURLRequest with something that nginx will handle as a non-SPDY, non-HTTP/2 request, e.g.
Upgrade: TLS/1.2
but the URL loading system might just stomp on it, in which case the only way to disable it would by configuring the server to compare the user agent string (or any other header that you provide) and refusing to upgrade the connection.

Mosquitto library usage with iOS

I am trying to use the MQTT protocol and am an amateur with this. I tried the objective-C code over Mosquitto library using MQTTKit (https://github.com/jmesnil/MQTTKit).
I am able to use it to publish messages to some test servers and things are working fine but still I have some basic questions, not so clear to me:
Does Mosquitto library include web sockets too underneath?
Is it possible to create a connection, subscribe to a topic and then server can also publish messages to device with realtime behavior? In other words, can we use it for real time communication between server and client (the iOS device in this case) bidirectional?
The mosquitto library does not support websockets, it is mqtt only.
Yes, mqtt is a bidirectional protocol. I believe there are difficulties with keeping a long term socket open on iOS that mean it isn't as straightforward to support as you might like. I'm not familiar with iOS at all though.
1.the mosquitto library of javascript has support websocket. you can go http://mosquitto.org/download/ to download.
2.mosquitto support MQTT protocol. When the connection was established, the mosquitto will send PINGREQ message for keep heartbeat.(the keep alive time please see MQTT protocol). the MQTT protocol is Publish / Subscribe (PubSub) model.So the server(broker) is central. Client subscribe topic, other client can receive message, and clietn can publish message to the another topic.That's all, you only need to set appropriate topic.

AFNetworking's AFHTTPClient how to debug the http request?

I'm having trouble getting AFNetworking to communicate successfully with a web service. Is there a way to log out (or view in some other way) the exact http request that it is sending?
You should check out AFHTTPRequestOperationLogger, which listens for the notifications sent when operations start and finish, and log them out with configurable verbosity.
I really like Charles for watching network traffic when using the simulator.

Resources