zwopple / PocketSocket

Objective-C websocket library for building things that work in realtime on iOS and OS X.
Other
414 stars 129 forks source link

How it works in background ? #45

Closed xxfenxx closed 8 years ago

xxfenxx commented 8 years ago

I use the framework to develop a IM app, but when the app enter background, it can not receive messages! What should I do?

robertjpayne commented 8 years ago

@LiangyongFShen we don't make any assumptions about backgrounding or activity. If you're developing a chat application I strongly recommend you implement the background activity API's or use push notifications to wake up the app and resume the socket connection.

Alternatively you can use the VOIP flag on the stream but you'd need to fork PocketSocket and set that yourself. It's not something we really are targeting since a WebSocket isn't normally VOIP.

xxfenxx commented 8 years ago

Thanks a lot ! Are that any blogs about setting VOIP flag on the stream ?

robertjpayne commented 8 years ago

@LiangyongFShen you normally have to be a Voice Over IP phone calling app to get that background activity entitlement through Apple App Review.

NSStreamNetworkServiceTypeVoIP is the flag you have to set on the stream, again you'll have to fork PocketSocket as you'll need to configure the stream.

Alternatively you can just use the PSWebSocketDriver and BYO networking.