iOS MEAN
Now that we have all the basics of building an iOS app, the instructor told us to mix things up by using sockets. Sockets, as I've explained back in the MEAN section, are little nodes of persistent connection that allows information to flow freely and in real time. Instead of writing Javascript as the front-end, our iOS app is going to be the front end. The server-side is just our server.js where it requires the socket node module. How do we connect our phone to the sockets? We download the sockets.io file from the Apple developer site, and we copy the files into our iOS project folder.
We then write a connect function and the same socket emits that we would in Javascript. On our server side, we have the socket.on method to hear what we are getting. From then on, we can transmit info via a second parameter in the emit method. The first couple assignments were pretty easy with just transmitting messages from the iPhone to the server and then to the webpage. Tomorrow, we will be using full MEAN.
No comments:
Post a Comment