Just note that even if you get the final project to test the app without getting involved in the implementation at all, the server part is something you have to mandatorily do if you want to see the app running.Additionally, even though I won’t show any server-side code at all in this tutorial, I’ll be talking quite frequently about the server part because in every single step it’s important to make clear what kind of data we are expecting from the server, or what the server is expecting from the app.The websocket communication relies on the client-server logic, where a persistent connection between a server and a client always exists.

Xxx mobile chat-14

You can find a couple of interesting topics about websockets here and here, but also feel free to search the web for additional information.

On my part, I’ll give you the big picture in simple words, so you are able to better understand what comes later.

Most importantly, when a message is sent to that port by a server, the recipient clients will instantly receive it, so they can take any further actions (like updating a news feed for example) immediately.

: Keep in mind that from now on I’ll mostly use the term “socket(s)” instead of “websocket(s)” just for simplicity.

Thankfully, there’s a better solution when it’s necessary to receive data from a server instantly (every time such data becomes available), and without having the app to send any request to the server at all.

That solution is based on making use of websockets, and it totally erases the couple aforementioned issues.First of all, the app will be parted by two view controllers: In the first one, the user will be able to “sign in” to the app by providing a nickname only (we’ll avoid a more complicated login mechanism for obvious reasons).Once that happens, all existing users will be listed in a tableview, where next to their names a connection status indication will be displayed ( The second view controller is dedicated to the chat functionality.i OS apps exist in millions out there, and most of them communicate with servers to exchange data.In their majority, the server implements and provides RESTful APIs that apps can use for the communication.The server-side part is interesting in this tutorial too, because a couple of actions are required in order to make it work.