Chapter 2. Mobile Messaging with STOMP

In this chapter, we will write our first messaging client: a native application running on an iPhone. We will use STOMP to send and receive messages using the Objective-C library StompKit.

In “Locations Application Using STOMP”, we described the Locations application. In this chapter, we will write the iOS application that broadcasts the device’s position and receives text messages (Figure 2-1).

Diagram of the Locations iOS application
Figure 2-1. Diagram of the Locations iOS application
Note

Throughout the chapter, we will show all the code required to run the application.

The whole application code can be retrieved from the GitHub repository in the stomp/ios/ directory.

StompKit

To use STOMP on iOS, we will use the StompKit Objective-C library that implements the STOMP protocol in a modern, event-driven way using ARC, Grand Central Dispatch, and blocks.

The source code of this library project is hosted on GitHub.

Create the Locations Project with Xcode

We will use Xcode to create the Locations iOS application. When Xcode is installed and started, we create a new project from its launch screen, as illustrated in Figure 2-2:

XCode Launch screen
Figure 2-2. Select “Create a new Xcode project” from the Xcode launch screen

The application consists of a single view, so we choose the Single View Application ...

Get Mobile and Web Messaging now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.