I have a chat feature in my app using
It makes an API call to my server every 5 seconds to get all the chat messages between two users to populate the chat view with those messages. It was suggested I turn that into a socket connection because making an API call every 5 seconds will be hard on the battery and a waste of API calls.
How do I turn my chat feature into a socket connection with my server?
Are there any libraries in Objective-C that will help me accomplish this? And also, I'm pretty sure that I'll have to set this up on the back end too, so are there any resources as to how to set this up on a
You should be able to accomplish this using a couple mature libraries on both the iOS frontend and the PHP backend.
They both support RFC 6455 so should integrate pretty easily.
Since you are using PHP, I'm going to take a stab and guess you are using Apache? If so, here is some more information on setting up websockets to work with Apache which can have issues with connection management: Setting up a websocket on Apache?