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)
- Navigate to the project root.
-
Install dependencies (VirtualEnv):
make test source .env/bin/activate pip install git+https://github.com/tornadoweb/tornado.git -
Start the chat server:
python TestChatServer/py/chatroom.py
Running the Go Server
-
Navigate to the Go directory:
cd TestChatServer/go -
Run the server:
go run chatroom.go
Both servers listen on port 9000 by default.
2. Running the iOS App
- Open
SocketRocket.xcodeprojin Xcode. - Select the
TestChatscheme. - Build and Run (
Cmd+R) on a Simulator or Device. - The app will attempt to connect to
localhost:9000(or the IP of your machine if running on a real device). - You can also chat via a browser by visiting
http://localhost:9000.