background preloader

Networking Tutorial for iOS: How To Create A Socket Based Server

Networking Tutorial for iOS: How To Create A Socket Based Server
If you're new here, you may want to subscribe to my RSS feed or follow me on Twitter. Thanks for visiting! Develop a socket-based iPhone app and server! Many iOS apps use HTTP to communicate to a web server, because it’s easy, convenient, and well-supported. However, in some cases you might find the need to go a bit lower level than HTTP, and communicate using TCP sockets to your own custom server. The advantages of doing this are several: You can send just the exact data you need to send – making your protocol lean and efficient.You can send connected clients data whenever you want, rather than requiring the clients to poll.You can write socket servers without a dependency of a web server, and can write in the language of your choice.Sometimes you just have to use sockets, if you are connecting to a legacy server! In this networking tutorial, you’ll get some hands-on experience writing an iPhone app that communicates to a TCP socket server using NSStream/CFStream. What is a socket? You see? Related:  live instant messaging

Geohashing Chat by User Proximity Tutorial - PubNub This geohashing tutorial walks you through how to build a realtime chat app that connects users based on relative location (ie. geohashing). To connect groups of two or more people by location, you will need to take lat/long values and reduce the resolution of accuracy. By doing this, you can expand the coverage of proximity. You can use multiple resolutions at once or a fixed resolution. Want to see geohashing in action? A full working demo can be seen here: Geohashing Chat by Proximity. Basics of Geohashing You’ll first need to sign up for a PubNub account. Next, we’ll cover some source code snippet for geohashing lat/long coords. Geohashing Resolution “Zoom” “Zoom” levels are basically several different cartesian grids with larger and smaller granularity. By reducing the resolution of the lat/long coord we can construct a channel name that hits 1 box of the grid. This will create a very wide circle and generate a channel name used to connect. Multiplexing 9 Boxes That’s it!

NSURLSession Tutorial Note from Ray: This is an abbreviated version of a chapter from iOS 7 by Tutorials that we are releasing as part of the iOS 7 Feast. We hope you enjoy! Each new iOS release contains some terrific new networking APIs, and iOS 7 is no exception. In iOS 7, Apple has introduced NSURLSession, which is a suite of classes that replaces NSURLConnection as the preferred method of networking. In this NSURLSession tutorial, you will learn what this new class is, why and how you should use it, how it compares to what’s been before, and most importantly: get practice integrating it into a real app! Note that this tutorial assumes you are familiar with basic networking concepts. Why Use NSURLSession? Why should you use NSURLSession? Background uploads and downloads: With just a configuration option when the NSURLSession is created, you get all the benefits of background networking. NSURLSession vs NSURLConnection “Wow, NSURLSession sounds complicated!” Now let’s use NSURLSession. Introducing Byte Club

PubNub Connected Car Solution Kit The PubNub Connected Car Solution Kit PubNub’s Connected Car Solution Kit provides the key building blocks for developers to deliver scalable, real-time transportation management and dispatch applications, including taxi, fleet management and delivery service. Connected cars require real-time signaling for effective dispatch and tracking, yet vehicles constantly change networks and cell towers, lose connectivity, and drop dedicated network connections. Built on its global Real-Time Network and supported on over 50+ SDKs, PubNub’s Connected Car Solution Kit addresses the inherent challenges posed by connected vehicles, ensuring reliable, real-time message streaming and other key services like dispatch, location tracking, and geo-fencing.

Unit Testing Tutorial for iOS: Xcode 4 Quick Start Guide If you're new here, you may want to subscribe to my RSS feed or follow me on Twitter. Thanks for visiting! Learn how to set up your Xcode project to perform Unit Testing! Unit testing is great because it makes your life easier. Easier to deliver high quality code, and easier to make changes without fear of breaking something! But what might not be so easy is getting started if you’re new to unit testing – and that’s what this tutorial is all about! We’ll cover how to set up Xcode to use three different unit testing frameworks: OCUnit, which is the unit testing framework built into Xcode GHUnit, which is a third party framework with some extra cool features OCMock, which helps you write mock objects to aid tricky testing scenarios We won’t cover how to actually write test cases in this unit testing tutorial, but don’t worry – I’ll be covering that in my upcoming tutorial series on Test Driven Development for iOS! Getting Started with OCUnit GHUnit vs OCUnit Introducing OCMock Getting Started

Building Real-Time Geolocation Apps With JavaScript Geolocation is a great way to add another layer of interactivity to a realtime application. By knowing the location of your users, it’s easy to group them into pools and provide data and notifications to specific user channels. Additionally, it can be a great combination for realtime applications such as geo based chatting, collaboration, and games. Contrary to popular belief, it’s actually easier to obtain and use geolocation data than some developers think. Design of Application To test this theory, we built a geolocation scavenger hunt application, much like Wherigo and Geocaching. Cross functionality across a number of different devices was one key benefit of GeoChatr. We used a Node.js server to manage the list of clues and locations. Code Samples You’ll first need to sign up for a PubNub account. Using the geolocation API was the easiest part of the entire process. One of the pitfalls I fell into was updating the nodes every time the watch position was called. Issues / Conclusion

How To Draw Graphs with Core Plot, Part 1 Use Core Plot to Draw Pie Charts, Bar Graphs, Scatter Plots and More! This is a blog post by iOS Tutorial Team member Steve Baranski, the founder of komorka technology, a provider of iOS development and consulting services. If you’ve ever wanted to include charts or graphs in your app, chances are you’ve considered the following two options: DIY. One option is to write all the drawing code yourself using Core Graphics/Quartz. Apple even has an example of this, in the SimpleStocks sample project.Buy it! But what if you don’t want to spend the time and effort to write it yourself, and don’t want to shell out a ton of money? Core Plot is an open-source plotting framework for both iOS and Mac OS X. In this 2-part tutorial series, we’ll show how you can use Core Plot to create pie charts, bar graphs, scatter plots, and more. To go through this tutorial, you need to have Xcode 4 installed, and a working knowledge of Objective-C, Interface Builder and storyboards. Adding Resources Wait a minute!

Anywall Anywall is a geocaching application that allows users to share messages by placing them in real world locations. The application is available on the app store, and is meant to give you an overview of a real app that uses Parse as a backend. In this tutorial, we'll not only look at all of the Parse functionality used, but also many concepts surrounding the uses of Parse. In Anywall, users log in and are able to see the closest posts both on a map and in a table. To view the content of a particular post, a user must be within a certain radius from the location it was dropped. This tutorial is divided into six parts that each focus on a different aspect of Anywall. 1. 2. 3. 4. 5. 6. 1.1. Anywall consists of six view controllers. Once a user is logged in, the PAWWallViewController is displayed. The PAWWallPostCreateViewController and the PAWSettingsViewController are both presented from the PAWWallViewController's navigation bar buttons. 1.2. 1.3. 2.1. 2.2. 2.3. 2.4. 2.4. 3.1. 3.2. 3.3.

Unity 4.3 2D Tutorial: Animation Controllers If you're new here, you may want to subscribe to my RSS feed or follow me on Twitter. Thanks for visiting! Learn how to use animation controllers to move between a state machine of animations in this Unity 4.3 2D tutorial! Welcome back to our Unity 4.3 2D Tutorial series! In the first part of the series, you started making a fun game called Zombie Conga, learning the basics of Unity 4.3’s built-in 2D support along the way. In the second part of the series, you learned how to animate the zombie and the cat using Unity’s powerful built-in animation system. In this third part of the series, you’ll get more practice creating Animation Clips, and you’ll learn how to control the playback of and transition between those clips. This tutorial picks up where the previous part ended. Just like you did in Part 2, unzip the file and open your scene by double-clicking ZombieConga/Assets/Scenes/CongaScene.unity. It’s time to make that cat dance! Getting Started Transitions Editing Transitions Animating a Color

AngularJS PubNub Chat Application The PubNub Angular API lives in the scripts/pubnub-angular.js file. Notice the dependency on the PubNub Angular library (pubnub.angular.service): angular.module('PubNubAngularApp', ["pubnub.angular.service"]) The code for the controllers lives in: Now, the PubNub service can be injected into the controller by name! .controller('JoinCtrl', function($scope, PubNub) { ... }); Using the Special AngularJS PubNub API Publishing to channels is trivial - just use the PubNub.ngPublish() method. As you can see, we call the PubNub publish method passing in the desired channel and message to transmit. It's not necessary to subscribe to a channel in order to publish to a channel. Subscribing to channels is accomplished by calling the PubNub.ngSubscribe() method. This is the core of the PubNub API - allowing clients to subscribe and publish to channels, and have those events propagate in real-time to other applications connected to the same channels. Integrating Presence Events $rootScope. $rootScope.

AFNetworking 2.0 Tutorial Learn how to use AFNetworking: an easy-to-use network API for iOS! Update 1/18/2014: Fully updated for iOS 7 and AFNetworking 2.0 (original post by Scott Sherwood, update by Joshua Greene). In iOS 7, Apple introduced NSURLSession as the new, preferred method of networking (as opposed to the older NSURLConnection API). Using this raw NSURLSession API is definitely a valid way to write your networking code – we even have a tutorial on that. However, there’s an alternative to consider – using the popular third party networking library AFNetworking. The latest version of AFNetworking (2.0) is now built on top of NSURLSession, so you get all of the great features provided there. AFNetworking is incredibly popular – it won our Reader’s Choice 2012 Best iOS Library Award. In this AFNetworking 2.0 tutorial, you will learn about the major components of AFNetworking by building a Weather App that uses feeds from World Weather Online. Getting Started From left to right, they are: Pretty easy, eh?

ruby on rails chat application over port 80 which is hosting site agnostic(no flash and websockets)

Related: