TestChat Demo Application

The repository includes a demo application called TestChat which demonstrates how to use SocketRocket in a real iOS application. It acts as a chat client connecting to a local server.

1. Setting up the Server

Before running the iOS app, you must start a WebSocket server. The repo provides implementations in Python and Go.

Prerequisites

  • Python 2.7+ / 3.x with pip
  • Go (optional)

Running the Python Server (Tornado)

  1. Navigate to the project root.
  2. Install dependencies (VirtualEnv):

    make test
    source .env/bin/activate
    pip install git+https://github.com/tornadoweb/tornado.git

  3. Start the chat server:

    python TestChatServer/py/chatroom.py

Running the Go Server

  1. Navigate to the Go directory:

    cd TestChatServer/go

  2. Run the server:

    go run chatroom.go

Both servers listen on port 9000 by default.

2. Running the iOS App

  1. Open SocketRocket.xcodeproj in Xcode.
  2. Select the TestChat scheme.
  3. Build and Run (Cmd+R) on a Simulator or Device.
  4. The app will attempt to connect to localhost:9000 (or the IP of your machine if running on a real device).
  5. You can also chat via a browser by visiting http://localhost:9000.