How can an iOS app keep a TCP connection alive indefinitely while in the background?

后端 未结 4 868
名媛妹妹
名媛妹妹 2020-12-02 09:53

An iPhone app, connecting to a remote server via TCP. The use scenarios are:

  1. app (user) sends data to server and server responds data back.
  2. server mig
4条回答
  •  南方客
    南方客 (楼主)
    2020-12-02 10:35

    For when the app is in the foreground:

    Look at STOMP http://stomp.codehaus.org/Protocol

    The STOMP Framework in Obj-C http://code.google.com/p/stompframework/

    and the ActiveMQ broker http://activemq.apache.org/

    For when the app is in the background I would probably go for using APNS (Notifications) to prompt the user to wake the app back up...

提交回复
热议问题