-
Notifications
You must be signed in to change notification settings - Fork 128
Make streams inherit networkServiceType from NSURLRequest #46
Conversation
….g. creation of VoIP background mode streams
@shaneomack91 I'm not sure I really want to support this, using "VOIP" to keep a websocket open is bad form and frankly if you get the entitlement capability pass app store review that doesn't mean you should do it. Doing so drastically decreasing iOS battery life as your app is kept alive, and it's network connections kept alive forever. It's akin to how Facebook got caught playing a silent audio file to keep the app running in the background. Do you have any legitimate reason to keep the socket open indefinitely in the background over just using the standard background activity API's or push notifications instead? |
@shaneomack91 for what it's worth you can already do this:
You have to set the property before you open it… |
I think you're missing the point that some developers (myself included) may Also, the entire point of VoIP mode is that the OS takes control of the On Friday, 22 April 2016, Robert Payne notifications@github.com wrote:
|
@shaneomack91 I may be a bit naive here but I can't help but think using a websocket is a terrible way to implement VOIP. It'd be like trying to build video streaming over websockets just a bad idea? The capability is there already with the stream properties anyways. If you're targeting iOS 8.0+ I'd strongly recommend you look at |
WebSocket is good for implementing a "control channel", where the actual That said, the particular app I am developing is currently using the I will eventually add a UDP "layer" to this but I am perfecting the On 22 April 2016 at 07:35, Robert Payne notifications@github.com wrote:
|
@shaneomack91 makes sense, I had a quick look at the commit again. It's sort of weird because AS such can you try just using the |
I changed my commit to use the newer APIs, they should not be depreceated. I am aware of PushKit and in fact I am also using it to start up the app when it is closed and and alert is sent. But PushKit does not keep the app running, which for my app is actually necessary because a dispatcher can send out an alert, then there will be people talking on their radios for half an hour or more afterwards and our users want to be able to hear this. |
@shaneomack91 np! Didn't realise there was non deprecated NS* version. Merging this now 👍 |
Thanks, I submitted this PR because this is how the other Objective-C/iOS WebSocket libraries do the same thing, and frankly, this library is way more reliable than they are. SocketRocket after a while stops processing incoming data, then bunches it all together at a later time. JetFire uses spinlocks, which uses 100% CPU and will kill the users battery in no time, not to mention being horribly slow (1-2 seconds for a packet to be sent and to receive the response) PocketSocket has neither of these problems, I left my app running (with these VoIP mode changes) overnight, in the background, and in the morning it was still connected and ready to rock. |
@shaneomack91 thanks for the kind words! I created and opensourced this for those exact reasons! |
This allows, for example, to create VoIP sockets by setting networkServiceType as follows: