iOS XMPP chat through HTTP proxy

余生颓废 提交于 2020-01-04 23:55:22

问题


I have an iPhone application which works with 2 services:

  1. work with REST service over http - use AFNetworking
  2. have XMPP chat over TCP - use XMPPFramework https://github.com/robbiehanson/XMPPFramework

My iPhone uses corporate network with proxy, so I set HTTP proxy in Settings http://qblx.co/1eJ9TwI

With this proxy settings all requests to REST service go through this proxy. But, my application connects direct to Chat server, without proxy.

How to make Chat works through proxy? As I can see, XMPPFramework uses GCDAsyncSocket as a transport https://github.com/robbiehanson/CocoaAsyncSocket

Do you have any suggestions how to setup Chat through proxy?


回答1:


XMPP by default uses plain TCP socket connection, which is not able to route via HTTP proxy. You can:

  • if your proxy supports HTTPS/Tunneling, try to use 443 port for your XMPP service, or forward 443 port to default XMPP service port(5222) on your router.
  • if your proxy supports SOCKS, try to use ProxyKit, but it may need to modify XMPPFramework code
  • You can try to use XMPP with HTTP or Websocket transport, but XMPPFramework did not support it and you may need to find/write different library


来源:https://stackoverflow.com/questions/23113087/ios-xmpp-chat-through-http-proxy

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!